Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-12-10 20:23:30 +0000
committerEric Williams2019-12-11 18:22:31 +0000
commitc1c3699c9190461b6b64f6c2672c5befd67c3f0c (patch)
treee0f329ffeeede501e7638d99ddd5a99c8f37cf70
parent823775bc9bc4982a48eb57242ce078c55550c85a (diff)
downloadeclipse.platform.swt-c1c3699c9190461b6b64f6c2672c5befd67c3f0c.tar.gz
eclipse.platform.swt-c1c3699c9190461b6b64f6c2672c5befd67c3f0c.tar.xz
eclipse.platform.swt-c1c3699c9190461b6b64f6c2672c5befd67c3f0c.zip
Bug 553678: Update GTK min version to 3.14
Remove support for versions of GTK3 < 3.14.0. Change-Id: I0c3306a5c21d30710d2d16e9fe34879674e45fc0 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c56
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java118
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java242
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java46
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java47
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java75
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java52
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java50
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java47
29 files changed, 239 insertions, 736 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
index 8cbf16e5f8..dde5af62f0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
@@ -325,7 +325,7 @@ void dragBegin(long widget, long context) {
* When we recieve the signal from GTK of DragBegin, we will
* notify SWT that a drag has occurred.
*/
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0) && this.control instanceof Text) {
+ if (this.control instanceof Text) {
DNDEvent event = new DNDEvent();
Display display = Display.getCurrent();
Point loc = display.getCursorLocation();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index c9bd6bf74a..859f6fbdd1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -12563,50 +12563,6 @@ JNIEXPORT jboolean JNICALL GTK_NATIVE(_1gtk_1widget_1mnemonic_1activate)
}
#endif
-#ifndef NO__1gtk_1widget_1override_1background_1color
-JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1override_1background_1color)
- (JNIEnv *env, jclass that, jlong arg0, jint arg1, jobject arg2)
-{
- GdkRGBA _arg2, *lparg2=NULL;
- GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1override_1background_1color_FUNC);
- if (arg2) if ((lparg2 = getGdkRGBAFields(env, arg2, &_arg2)) == NULL) goto fail;
-/*
- gtk_widget_override_background_color(arg0, arg1, lparg2);
-*/
- {
- GTK_LOAD_FUNCTION(fp, gtk_widget_override_background_color)
- if (fp) {
- ((void (CALLING_CONVENTION*)(jlong, jint, GdkRGBA *))fp)(arg0, arg1, lparg2);
- }
- }
-fail:
- if (arg2 && lparg2) setGdkRGBAFields(env, arg2, lparg2);
- GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1override_1background_1color_FUNC);
-}
-#endif
-
-#ifndef NO__1gtk_1widget_1override_1color
-JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1override_1color)
- (JNIEnv *env, jclass that, jlong arg0, jint arg1, jobject arg2)
-{
- GdkRGBA _arg2, *lparg2=NULL;
- GTK_NATIVE_ENTER(env, that, _1gtk_1widget_1override_1color_FUNC);
- if (arg2) if ((lparg2 = getGdkRGBAFields(env, arg2, &_arg2)) == NULL) goto fail;
-/*
- gtk_widget_override_color(arg0, arg1, lparg2);
-*/
- {
- GTK_LOAD_FUNCTION(fp, gtk_widget_override_color)
- if (fp) {
- ((void (CALLING_CONVENTION*)(jlong, jint, GdkRGBA *))fp)(arg0, arg1, lparg2);
- }
- }
-fail:
- if (arg2 && lparg2) setGdkRGBAFields(env, arg2, lparg2);
- GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1override_1color_FUNC);
-}
-#endif
-
#ifndef NO__1gtk_1widget_1override_1font
JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1override_1font)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
@@ -15036,18 +14992,6 @@ fail:
}
#endif
-#ifndef NO__1g_1hash_1table_1get_1values
-JNIEXPORT jlong JNICALL OS_NATIVE(_1g_1hash_1table_1get_1values)
- (JNIEnv *env, jclass that, jlong arg0)
-{
- jlong rc = 0;
- OS_NATIVE_ENTER(env, that, _1g_1hash_1table_1get_1values_FUNC);
- rc = (jlong)g_hash_table_get_values((GHashTable *)arg0);
- OS_NATIVE_EXIT(env, that, _1g_1hash_1table_1get_1values_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO__1g_1icon_1new_1for_1string
JNIEXPORT jlong JNICALL OS_NATIVE(_1g_1icon_1new_1for_1string)
(JNIEnv *env, jclass that, jbyteArray arg0, jlongArray arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 561cd7f972..6e34c81e90 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -994,8 +994,6 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1widget_1map",
"_1gtk_1widget_1measure",
"_1gtk_1widget_1mnemonic_1activate",
- "_1gtk_1widget_1override_1background_1color",
- "_1gtk_1widget_1override_1color",
"_1gtk_1widget_1override_1font",
"_1gtk_1widget_1queue_1draw",
"_1gtk_1widget_1queue_1resize",
@@ -1243,7 +1241,6 @@ char * OS_nativeFunctionNames[] = {
"_1g_1filename_1to_1utf8",
"_1g_1get_1current_1time",
"_1g_1getenv",
- "_1g_1hash_1table_1get_1values",
"_1g_1icon_1new_1for_1string",
"_1g_1icon_1to_1string",
"_1g_1idle_1add",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 87d3bdfb1b..e82617572e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -992,8 +992,6 @@ typedef enum {
_1gtk_1widget_1map_FUNC,
_1gtk_1widget_1measure_FUNC,
_1gtk_1widget_1mnemonic_1activate_FUNC,
- _1gtk_1widget_1override_1background_1color_FUNC,
- _1gtk_1widget_1override_1color_FUNC,
_1gtk_1widget_1override_1font_FUNC,
_1gtk_1widget_1queue_1draw_FUNC,
_1gtk_1widget_1queue_1resize_FUNC,
@@ -1217,7 +1215,6 @@ typedef enum {
_1g_1filename_1to_1utf8_FUNC,
_1g_1get_1current_1time_FUNC,
_1g_1getenv_FUNC,
- _1g_1hash_1table_1get_1values_FUNC,
_1g_1icon_1new_1for_1string_FUNC,
_1g_1icon_1to_1string_FUNC,
_1g_1idle_1add_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
index 1050f0826c..d7ccfeda28 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
@@ -8927,32 +8927,6 @@ public class GTK extends OS {
/**
* @method flags=dynamic
*/
- public static final native void _gtk_widget_override_color(long widget, int state, GdkRGBA color);
- /** [GTK3; 3.16 deprecated, replaced]*/
- public static final void gtk_widget_override_color(long widget, int state, GdkRGBA color) {
- lock.lock();
- try {
- _gtk_widget_override_color(widget, state, color);
- } finally {
- lock.unlock();
- }
- }
- /**
- * @method flags=dynamic
- */
- public static final native void _gtk_widget_override_background_color(long widget, int state, GdkRGBA color);
- /** [GTK3; 3.16 deprecated, replaced] */
- public static final void gtk_widget_override_background_color(long widget, int state, GdkRGBA color) {
- lock.lock();
- try {
- _gtk_widget_override_background_color(widget, state, color);
- } finally {
- lock.unlock();
- }
- }
- /**
- * @method flags=dynamic
- */
public static final native void _gtk_widget_override_font(long widget, long font);
/** [GTK3; 3.16 deprecated] */
public static final void gtk_widget_override_font(long widget, long font) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 185509edf8..8f4fdfe734 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -1764,18 +1764,6 @@ public static final void g_time_val_add(long result, long microseconds) {
}
}
/**
- * @param table cast=(GHashTable *)
- */
-public static final native long _g_hash_table_get_values(long table);
-public static final long g_hash_table_get_values(long table) {
- lock.lock();
- try {
- return _g_hash_table_get_values(table);
- } finally {
- lock.unlock();
- }
-}
-/**
* @param function cast=(GSourceFunc)
* @param data cast=(gpointer)
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index b3ae175771..463a5ec577 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -757,7 +757,7 @@ private void overrideThemeValues () {
// Load CSS from user-defined CSS file.
String additionalCSSPath = System.getProperty("org.eclipse.swt.internal.gtk.cssFile");
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0) && additionalCSSPath != null){
+ if (additionalCSSPath != null){
// Warning:
// - gtk css syntax changed in 3.20. If you load custom css, it could break things depending on gtk version on system.
// - Also, a lot of custom css/themes are buggy and may result in additional console warnings.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
index c171f9f18e..78cbbbe32e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
@@ -2055,11 +2055,7 @@ Rectangle getClippingInPixels() {
/* Intersect visible bounds with clipping */
if (clipRgn != 0) {
/* Convert clipping to device space if needed */
- if (data.clippingTransform != null && GTK.GTK_VERSION < OS.VERSION (3, 14, 0)) {
- clipRgn = convertRgn(clipRgn, data.clippingTransform);
- Cairo.cairo_region_intersect(rgn, clipRgn);
- Cairo.cairo_region_destroy(clipRgn);
- } else if (!Arrays.equals(data.clippingTransform, currentTransform) && GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
+ if (!Arrays.equals(data.clippingTransform, currentTransform)) {
double[] clippingTransform;
if (currentTransform != null && data.clippingTransform == null) {
/*
@@ -2109,15 +2105,6 @@ Rectangle getClippingInPixels() {
Cairo.cairo_region_intersect(rgn, clipRgn);
}
}
- /* Convert to user space */
- if (cairo != 0 && GTK.GTK_VERSION < OS.VERSION (3, 14, 0)) {
- double[] matrix = new double[6];
- Cairo.cairo_get_matrix(cairo, matrix);
- Cairo.cairo_matrix_invert(matrix);
- clipRgn = convertRgn(rgn, matrix);
- Cairo.cairo_region_destroy(rgn);
- rgn = clipRgn;
- }
Cairo.cairo_region_get_extents(rgn, rect);
Cairo.cairo_region_destroy(rgn);
x = rect.x;
@@ -2148,7 +2135,6 @@ public void getClipping(Region region) {
if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
long clipping = region.handle;
Cairo.cairo_region_subtract(clipping, clipping);
- long cairo = data.cairo;
long clipRgn = data.clipRgn;
if (clipRgn == 0) {
cairo_rectangle_int_t rect = new cairo_rectangle_int_t();
@@ -2158,28 +2144,11 @@ public void getClipping(Region region) {
rect.height = height[0];
Cairo.cairo_region_union_rectangle(clipping, rect);
} else {
- /* Convert clipping to device space if needed */
- if (data.clippingTransform != null && GTK.GTK_VERSION < OS.VERSION (3, 14, 0)) {
- long rgn = convertRgn(clipRgn, data.clippingTransform);
- Cairo.cairo_region_union(clipping, rgn);
- Cairo.cairo_region_destroy(rgn);
- } else {
- Cairo.cairo_region_union(clipping, clipRgn);
- }
+ Cairo.cairo_region_union(clipping, clipRgn);
}
if (data.damageRgn != 0) {
Cairo.cairo_region_intersect(clipping, data.damageRgn);
}
- /* Convert to user space */
- if (cairo != 0 && GTK.GTK_VERSION < OS.VERSION (3, 14, 0)) {
- double[] matrix = new double[6];
- Cairo.cairo_get_matrix(cairo, matrix);
- Cairo.cairo_matrix_invert(matrix);
- long rgn = convertRgn(clipping, matrix);
- Cairo.cairo_region_subtract(clipping, clipping);
- Cairo.cairo_region_union(clipping, rgn);
- Cairo.cairo_region_destroy(rgn);
- }
}
/**
@@ -2560,17 +2529,10 @@ public void getTransform(Transform transform) {
* They do not want to know about the global coordinates of their widget, which is contained in Cairo.cairo_get_matrix().
* So we return whatever the client specified with setTransform.
*/
- if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
- if (currentTransform != null) {
- transform.handle = currentTransform.clone();
- } else {
- transform.handle = new double[] { 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 };
- }
+ if (currentTransform != null) {
+ transform.handle = currentTransform.clone();
} else {
- Cairo.cairo_get_matrix(cairo, transform.handle);
- double[] identity = identity();
- Cairo.cairo_matrix_invert(identity);
- Cairo.cairo_matrix_multiply(transform.handle, transform.handle, identity);
+ transform.handle = new double[] { 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 };
}
} else {
transform.setElements(1, 0, 0, 1, 0, 0);
@@ -2654,14 +2616,10 @@ void init(Drawable drawable, GCData data, long gdkGC) {
initCairo();
if ((data.style & SWT.MIRRORED) != 0) {
// Don't overwrite the Cairo transformation matrix in GTK 3.14 and above; it contains a translation relative to the parent widget.
- if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
- int[] w = new int[1], h = new int[1];
- getSize(w, h);
- Cairo.cairo_translate(cairo, w[0], 0);
- Cairo.cairo_scale(cairo, -1.0, 1.0);
- } else {
- Cairo.cairo_set_matrix(data.cairo, identity());
- }
+ int[] w = new int[1], h = new int[1];
+ getSize(w, h);
+ Cairo.cairo_translate(cairo, w[0], 0);
+ Cairo.cairo_scale(cairo, -1.0, 1.0);
}
if (cairoTransformationMatrix == null) cairoTransformationMatrix = new double[6];
Cairo.cairo_get_matrix(data.cairo, cairoTransformationMatrix);
@@ -2972,9 +2930,7 @@ void setCairoClip(long damageRgn, long clipRgn) {
* The Cairo handle is shared by all widgets, but GC.setClipping allows global clipping changes.
* So we intersect whatever the client sets with the initial GC clipping.
*/
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- limitClipping(clipRgnCopy);
- }
+ limitClipping(clipRgnCopy);
setCairoRegion(cairo, clipRgnCopy);
Cairo.cairo_clip(cairo);
@@ -3075,7 +3031,6 @@ private static Rectangle getTransformedClippingRectangle(int[] pointsArray) {
}
void setClipping(long clipRgn) {
- long cairo = data.cairo;
if (clipRgn == 0) {
if (data.clipRgn != 0) {
Cairo.cairo_region_destroy(data.clipRgn);
@@ -3087,10 +3042,7 @@ void setClipping(long clipRgn) {
if (data.clipRgn == 0) data.clipRgn = Cairo.cairo_region_create();
Cairo.cairo_region_subtract(data.clipRgn, data.clipRgn);
Cairo.cairo_region_union(data.clipRgn, clipRgn);
- if (GTK.GTK_VERSION < OS.VERSION (3, 14, 0)) {
- if (data.clippingTransform == null) data.clippingTransform = new double[6];
- Cairo.cairo_get_matrix(cairo, data.clippingTransform);
- } else if (currentTransform != null) {
+ if (currentTransform != null) {
// store the current transformation, to use it when the user requests clipping bounds
data.clippingTransform = currentTransform.clone();
} else {
@@ -3205,17 +3157,13 @@ void setClippingInPixels(Rectangle rect) {
}
private void resetClipping() {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- /*
- * Bug 531667: widgets paint over other widgets
- *
- * The Cairo handle is shared by all widgets, and GC.setClipping(0) allows painting outside the current GC area.
- * So if we reset any custom clipping we still want to restrict GC operations with the initial GC clipping.
- */
- setClipping(clipping);
- } else {
- setClipping(0);
- }
+ /*
+ * Bug 531667: widgets paint over other widgets
+ *
+ * The Cairo handle is shared by all widgets, and GC.setClipping(0) allows painting outside the current GC area.
+ * So if we reset any custom clipping we still want to restrict GC operations with the initial GC clipping.
+ */
+ setClipping(clipping);
}
/**
@@ -3807,25 +3755,17 @@ public void setTransform(Transform transform) {
if (data.cairo == 0 && transform == null) return;
initCairo();
long cairo = data.cairo;
- if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
- // Re-set the original Cairo transformation matrix: it contains a translation relative to the parent widget.
- if (currentTransform != null) {
- Cairo.cairo_set_matrix(cairo, cairoTransformationMatrix);
- currentTransform = null;
- }
- // Apply user transform on top of the current transformation matrix (and remember it)
- if (transform != null) {
- currentTransform = transform.handle.clone();
- double[] transformMatrix = identity();
- Cairo.cairo_matrix_multiply(transformMatrix, transform.handle, transformMatrix);
- Cairo.cairo_transform(cairo, transformMatrix);
- }
- } else {
- double[] identity = identity();
- if (transform != null) {
- Cairo.cairo_matrix_multiply(identity, transform.handle, identity);
- }
- Cairo.cairo_set_matrix(cairo, identity);
+ // Re-set the original Cairo transformation matrix: it contains a translation relative to the parent widget.
+ if (currentTransform != null) {
+ Cairo.cairo_set_matrix(cairo, cairoTransformationMatrix);
+ currentTransform = null;
+ }
+ // Apply user transform on top of the current transformation matrix (and remember it)
+ if (transform != null) {
+ currentTransform = transform.handle.clone();
+ double[] transformMatrix = identity();
+ Cairo.cairo_matrix_multiply(transformMatrix, transform.handle, transformMatrix);
+ Cairo.cairo_transform(cairo, transformMatrix);
}
data.state &= ~DRAW_OFFSET;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index 6965869e3c..aac38587fc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -973,10 +973,6 @@ void setForegroundGdkRGBA (GdkRGBA rgba) {
@Override
void setForegroundGdkRGBA (long handle, GdkRGBA rgba) {
- if (GTK.GTK_VERSION < OS.VERSION(3, 14, 0)) {
- super.setForegroundGdkRGBA(handle, rgba);
- return;
- }
long context = GTK.gtk_widget_get_style_context (handle);
GdkRGBA toSet = rgba == null ? display.COLOR_WIDGET_FOREGROUND_RGBA : rgba;
@@ -1034,13 +1030,10 @@ private void gtk_swt_set_border_color (GdkRGBA rgba) {
css_string += "}\n";
String finalCss;
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- // Cache foreground color
- cssForeground += "\n" + css_string;
- finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.FOREGROUND);
- } else {
- finalCss = css_string;
- }
+
+ // Cache foreground color
+ cssForeground += "\n" + css_string;
+ finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.FOREGROUND);
// Apply the CSS
long context = GTK.gtk_widget_get_style_context (handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
index 410757b993..a3cb964374 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
@@ -2224,16 +2224,10 @@ void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) {
// For read only Combos, we can just apply the background CSS to the GtkToggleButton.
gtk_css_provider_load_from_css (GTK.gtk_widget_get_style_context(buttonHandle), finalCss);
} else {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- // GtkEntry and GtkToggleButton needs to be themed separately with different
- // providers for coherent background. Similar to Tree/Table headers.
- gtk_css_provider_load_from_css (GTK._gtk_widget_get_style_context(entryHandle), finalCss);
- setButtonBackgroundGdkRGBA (rgba);
- } else {
- // Maintain GTK3.12- functionality
- setBackgroundGradientGdkRGBA (GTK.gtk_widget_get_style_context (entryHandle), handle, rgba);
- super.setBackgroundGdkRGBA (GTK.gtk_widget_get_style_context (entryHandle), entryHandle, rgba);
- }
+ // GtkEntry and GtkToggleButton needs to be themed separately with different
+ // providers for coherent background. Similar to Tree/Table headers.
+ gtk_css_provider_load_from_css (GTK._gtk_widget_get_style_context(entryHandle), finalCss);
+ setButtonBackgroundGdkRGBA (rgba);
}
// Set the background color of the text of the drop down menu.
OS.g_object_set (textRenderer, OS.background_rgba, rgba, 0);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 537c383e53..ae82cf7f2d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -437,20 +437,18 @@ void adjustChildClipping (long widget) {
@Override
long gtk_draw (long widget, long cairo) {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- long context = GTK.gtk_widget_get_style_context(widget);
- GtkAllocation allocation = new GtkAllocation();
- GTK.gtk_widget_get_allocation (widget, allocation);
- int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
- int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
- // We specify a 0 value for x & y as we want the whole widget to be
- // colored, not some portion of it.
- GTK.gtk_render_background(context, cairo, 0, 0, width, height);
- if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
- // If fixClipHandle is set: iterate through the children of widget
- // and set their clips to be that of their allocation
- if (widget == fixClipHandle) fixClippings();
- }
+ long context = GTK.gtk_widget_get_style_context(widget);
+ GtkAllocation allocation = new GtkAllocation();
+ GTK.gtk_widget_get_allocation (widget, allocation);
+ int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
+ int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
+ // We specify a 0 value for x & y as we want the whole widget to be
+ // colored, not some portion of it.
+ GTK.gtk_render_background(context, cairo, 0, 0, width, height);
+ if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
+ // If fixClipHandle is set: iterate through the children of widget
+ // and set their clips to be that of their allocation
+ if (widget == fixClipHandle) fixClippings();
}
return super.gtk_draw(widget, cairo);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 494b0fce02..98c57ee23d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -54,7 +54,6 @@ public abstract class Control extends Widget implements Drawable {
long redrawWindow, enableWindow, provider;
long redrawSurface, enableSurface;
int drawCount, backgroundAlpha = 255;
- long enterNotifyEventId;
long dragGesture, zoomGesture, rotateGesture, panGesture;
Composite parent;
Cursor cursor;
@@ -89,12 +88,6 @@ public abstract class Control extends Widget implements Drawable {
LinkedList <Event> dragDetectionQueue;
- /* these class variables are for the workaround for bug #427776 */
- static Callback enterNotifyEventFunc;
- static int enterNotifyEventSignalId;
- static int GTK_POINTER_WINDOW;
- static int SWT_GRAB_WIDGET;
-
static Callback gestureZoom, gestureRotation, gestureSwipe, gestureBegin, gestureEnd;
static {
gestureZoom = new Callback (Control.class, "magnifyProc", void.class, new Type[] {
@@ -565,18 +558,6 @@ void hookEvents () {
long topHandle = topHandle ();
OS.g_signal_connect_closure_by_id (topHandle, display.signalIds [MAP], 0, display.getClosure (MAP), true);
-
- if (enterNotifyEventFunc == null && GTK.GTK_VERSION < OS.VERSION (3, 11, 9)) {
- enterNotifyEventFunc = new Callback (Control.class, "enterNotifyEventProc", 4);
- if (enterNotifyEventFunc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
-
- enterNotifyEventSignalId = OS.g_signal_lookup (OS.enter_notify_event, GTK.GTK_TYPE_WIDGET ());
-
- byte [] buffer = Converter.wcsToMbcs ("gtk-pointer-window", true);
- GTK_POINTER_WINDOW = OS.g_quark_from_string (buffer);
- buffer = Converter.wcsToMbcs ("swt-grab-widget", true);
- SWT_GRAB_WIDGET = OS.g_quark_from_string (buffer);
- }
}
boolean hooksPaint () {
@@ -786,19 +767,6 @@ void checkBackground () {
} while (true);
}
-void checkForeground () {
- /*
- * Feature in GTK 3. The widget foreground is inherited from the immediate
- * parent. This is not the expected behavior for SWT. The fix is to avoid
- * the inheritance by explicitly setting the default foreground on the widget.
- *
- * This can be removed on GTK3.16+.
- */
- if (GTK.GTK_VERSION < OS.VERSION(3, 14, 0)) {
- setForegroundGdkRGBA (topHandle (), display.COLOR_WIDGET_FOREGROUND_RGBA);
- }
-}
-
void checkBorder () {
if (getBorderWidthInPixels () == 0) style &= ~SWT.BORDER;
}
@@ -828,7 +796,6 @@ void createWidget (int index) {
checkOrientation (parent);
super.createWidget (index);
checkBackground ();
- checkForeground ();
if ((state & PARENT_BACKGROUND) != 0) setParentBackground ();
checkBuffered ();
showWidget ();
@@ -3008,33 +2975,18 @@ public Image getBackgroundImage () {
}
GdkRGBA getContextBackgroundGdkRGBA () {
- long fontHandle = fontHandle ();
if ((state & BACKGROUND) == 0) {
return defaultBackground();
}
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- if (provider != 0) {
- return display.gtk_css_parse_background (display.gtk_css_provider_to_string(provider), null);
- } else {
- return defaultBackground();
- }
+ if (provider != 0) {
+ return display.gtk_css_parse_background (display.gtk_css_provider_to_string(provider), null);
} else {
- long context = GTK.gtk_widget_get_style_context (fontHandle);
- GdkRGBA rgba = new GdkRGBA ();
- GTK.gtk_style_context_get_background_color (context, GTK.GTK_STATE_FLAG_NORMAL, rgba);
- return rgba;
+ return defaultBackground();
}
}
GdkRGBA getContextColorGdkRGBA () {
- long fontHandle = fontHandle ();
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- return display.gtk_css_parse_foreground(display.gtk_css_provider_to_string(provider), null);
- } else {
- long context = GTK.gtk_widget_get_style_context (fontHandle);
- GdkRGBA rgba = display.styleContextGetColor (context, GTK.GTK_STATE_FLAG_NORMAL);
- return rgba;
- }
+ return display.gtk_css_parse_foreground(display.gtk_css_provider_to_string(provider), null);
}
GdkRGBA getBgGdkRGBA () {
@@ -3915,9 +3867,7 @@ long gtk_draw (long widget, long cairo) {
*/
if (drawRegion) data.regionSet = eventRegion;
// data.damageRgn = gdkEvent.region;
- if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
- data.cairo = cairo;
- }
+ data.cairo = cairo;
GC gc = event.gc = GC.gtk_new (this, data);
// Note: use GC#setClipping(x,y,width,height) because GC#setClipping(Rectangle) got broken by bug 446075
gc.setClipping (eventBounds.x, eventBounds.y, eventBounds.width, eventBounds.height);
@@ -5046,38 +4996,16 @@ private void _setBackground (Color color) {
void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) {
GdkRGBA selectedBackground = display.getSystemColor(SWT.COLOR_LIST_SELECTION).handle;
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- // Form background string
- String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
- : display.gtk_widget_get_name(handle);
- String css = name + " {background-color: " + display.gtk_rgba_to_css_string(rgba) + ";}\n"
- + name + ":selected" + " {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ // Form background string
+ String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
+ : display.gtk_widget_get_name(handle);
+ String css = name + " {background-color: " + display.gtk_rgba_to_css_string(rgba) + ";}\n"
+ + name + ":selected" + " {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
// Cache background
cssBackground = css;
// Apply background color and any cached foreground color
- String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
- gtk_css_provider_load_from_css (context, finalCss);
- } else {
- GTK.gtk_widget_override_background_color (handle, GTK.GTK_STATE_FLAG_NORMAL, rgba);
- GTK.gtk_widget_override_background_color(handle, GTK.GTK_STATE_FLAG_SELECTED, selectedBackground);
- }
-}
-
-void setBackgroundGradientGdkRGBA (long context, long handle, GdkRGBA rgba) {
- String css ="* {\n";
- if (rgba != null) {
- String color = display.gtk_rgba_to_css_string (rgba);
- //Note, use 'background-image' CSS class with caution. Not all themes/widgets support it. (e.g button doesn't).
- //Use 'background' CSS class where possible instead unless 'background-image' is explicidly supported.
- css += "background-image: -gtk-gradient (linear, 0 0, 0 1, color-stop(0, " + color + "), color-stop(1, " + color + "));\n";
- }
- css += "}\n";
- //Cache background color
- cssBackground = css;
-
- // Apply background color and any cached foreground color
String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
gtk_css_provider_load_from_css (context, finalCss);
}
@@ -5262,29 +5190,6 @@ public void setDragDetect (boolean dragDetect) {
}
}
-static long enterNotifyEventProc (long ihint, long n_param_values, long param_values, long data) {
- /* 427776: this workaround listens to the enter-notify-event signal on all
- * GtkWidgets. If enableWindow (the data parameter) has been added to the
- * internal hash table of the widget, a record is kept as the lifetime of
- * enableWindow is controlled here, so we'll need to remove that reference
- * when we destroy enableWindow. this internal hash table was removed in
- * GTK 3.11.9 so once only newer GTK is targeted, this workaround can be
- * removed. */
- long instance = OS.g_value_peek_pointer (param_values);
- long hashTable = OS.g_object_get_qdata (instance, GTK_POINTER_WINDOW);
-
- // there will only ever be one item in the hash table
- if (hashTable != 0) {
- long firstItem = OS.g_hash_table_get_values (hashTable);
- long gdkWindow = OS.g_list_data (firstItem);
- // data is actually enableWindow
- if (gdkWindow == data)
- OS.g_object_set_qdata(gdkWindow, SWT_GRAB_WIDGET, instance);
- }
-
- return 1; // keep the signal connected
-}
-
/**
* Enables the receiver if the argument is <code>true</code>,
* and disables it otherwise. A disabled control is typically
@@ -5362,13 +5267,6 @@ public void setEnabled (boolean enabled) {
attributes.window_type = GDK.GDK_WINDOW_CHILD;
enableWindow = GDK.gdk_window_new (window, attributes, GDK.GDK_WA_X | GDK.GDK_WA_Y);
if (enableWindow != 0) {
- /* 427776: we need to listen to all enter-notify-event signals to
- * see if this new GdkWindow has been added to a widget's internal
- * hash table, so when the GdkWindow is destroyed we can also remove
- * that reference. */
- if (enterNotifyEventFunc != null)
- enterNotifyEventId = OS.g_signal_add_emission_hook (enterNotifyEventSignalId, 0, enterNotifyEventFunc.getAddress (), enableWindow, 0);
-
GDK.gdk_window_set_user_data (enableWindow, parentHandle);
restackWindow (enableWindow, gtk_widget_get_window (topHandle), true);
if (GTK.gtk_widget_get_visible (topHandle)) GDK.gdk_window_show_unraised (enableWindow);
@@ -5379,24 +5277,6 @@ public void setEnabled (boolean enabled) {
}
void cleanupEnableWindow() {
- if (enterNotifyEventFunc != null) {
- if (enterNotifyEventId > 0)
- OS.g_signal_remove_emission_hook(enterNotifyEventSignalId, enterNotifyEventId);
- enterNotifyEventId = 0;
-
- /*
- * 427776: now we can remove any reference to the GdkWindow
- * in a widget's internal hash table. this internal hash
- * table was removed in GTK 3.11.9 so once only newer GTK is
- * targeted, this workaround can be removed.
- */
- long grabWidget = OS.g_object_get_qdata(enableWindow, SWT_GRAB_WIDGET);
- if (grabWidget != 0) {
- OS.g_object_set_qdata(grabWidget, GTK_POINTER_WINDOW, 0);
- OS.g_object_set_qdata(enableWindow, SWT_GRAB_WIDGET, 0);
- }
- }
-
GDK.gdk_window_set_user_data (enableWindow, 0);
GDK.gdk_window_destroy (enableWindow);
enableWindow = 0;
@@ -5507,38 +5387,29 @@ void setForegroundGdkRGBA (GdkRGBA rgba) {
}
void setForegroundGdkRGBA (long handle, GdkRGBA rgba) {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- GdkRGBA toSet;
- if (rgba != null) {
- toSet = rgba;
- } else {
- toSet = display.COLOR_WIDGET_FOREGROUND_RGBA;
- }
- long context = GTK.gtk_widget_get_style_context (handle);
- // Form foreground string
- String color = display.gtk_rgba_to_css_string(toSet);
- String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
- : display.gtk_widget_get_name(handle);
- GdkRGBA selectedForeground = display.COLOR_LIST_SELECTION_TEXT_RGBA;
- String selection = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) &&
- !name.contains("treeview") ? " selection" : ":selected";
- String css = "* {color: " + color + ";}\n"
- + name + selection + " {color: " + display.gtk_rgba_to_css_string(selectedForeground) + ";}";
+ GdkRGBA toSet;
+ if (rgba != null) {
+ toSet = rgba;
+ } else {
+ toSet = display.COLOR_WIDGET_FOREGROUND_RGBA;
+ }
+ long context = GTK.gtk_widget_get_style_context (handle);
+ // Form foreground string
+ String color = display.gtk_rgba_to_css_string(toSet);
+ String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
+ : display.gtk_widget_get_name(handle);
+ GdkRGBA selectedForeground = display.COLOR_LIST_SELECTION_TEXT_RGBA;
+ String selection = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) &&
+ !name.contains("treeview") ? " selection" : ":selected";
+ String css = "* {color: " + color + ";}\n"
+ + name + selection + " {color: " + display.gtk_rgba_to_css_string(selectedForeground) + ";}";
// Cache foreground color
cssForeground = css;
// Apply foreground color and any cached background color
- String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.FOREGROUND);
- gtk_css_provider_load_from_css(context, finalCss);
- } else {
- GdkRGBA selectedForeground = display.COLOR_LIST_SELECTION_TEXT_RGBA;
- GTK.gtk_widget_override_color (handle, GTK.GTK_STATE_FLAG_NORMAL, rgba);
- GTK.gtk_widget_override_color (handle, GTK.GTK_STATE_FLAG_SELECTED, selectedForeground);
- long context = GTK.gtk_widget_get_style_context (handle);
- GTK.gtk_style_context_invalidate (context);
- return;
- }
+ String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.FOREGROUND);
+ gtk_css_provider_load_from_css(context, finalCss);
}
void setInitialBounds () {
@@ -5592,15 +5463,13 @@ boolean mustBeVisibleOnInitBounds() {
* TODO currently phase is set to BUBBLE = 2. Look into using groups perhaps.
*/
private void setDragGesture () {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- dragGesture = GTK.gtk_gesture_drag_new (handle);
- GTK.gtk_event_controller_set_propagation_phase (dragGesture,
- 2);
- GTK.gtk_gesture_single_set_button (dragGesture, 0);
- OS.g_signal_connect(dragGesture, OS.begin, gestureBegin.getAddress(), this.handle);
- OS.g_signal_connect(dragGesture, OS.end, gestureEnd.getAddress(), this.handle);
- return;
- }
+ dragGesture = GTK.gtk_gesture_drag_new (handle);
+ GTK.gtk_event_controller_set_propagation_phase (dragGesture,
+ 2);
+ GTK.gtk_gesture_single_set_button (dragGesture, 0);
+ OS.g_signal_connect(dragGesture, OS.begin, gestureBegin.getAddress(), this.handle);
+ OS.g_signal_connect(dragGesture, OS.end, gestureEnd.getAddress(), this.handle);
+ return;
}
//private void setPanGesture () {
@@ -5608,27 +5477,23 @@ private void setDragGesture () {
//}
private void setRotateGesture () {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- rotateGesture = GTK.gtk_gesture_rotate_new(handle);
- GTK.gtk_event_controller_set_propagation_phase (rotateGesture,
- 2);
- OS.g_signal_connect (rotateGesture, OS.angle_changed, gestureRotation.getAddress(), this.handle);
- OS.g_signal_connect(rotateGesture, OS.begin, gestureBegin.getAddress(), this.handle);
- OS.g_signal_connect(rotateGesture, OS.end, gestureEnd.getAddress(), this.handle);
- return;
- }
+ rotateGesture = GTK.gtk_gesture_rotate_new(handle);
+ GTK.gtk_event_controller_set_propagation_phase (rotateGesture,
+ 2);
+ OS.g_signal_connect (rotateGesture, OS.angle_changed, gestureRotation.getAddress(), this.handle);
+ OS.g_signal_connect(rotateGesture, OS.begin, gestureBegin.getAddress(), this.handle);
+ OS.g_signal_connect(rotateGesture, OS.end, gestureEnd.getAddress(), this.handle);
+ return;
}
private void setZoomGesture () {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- zoomGesture = GTK.gtk_gesture_zoom_new(handle);
- GTK.gtk_event_controller_set_propagation_phase (zoomGesture,
- 2);
- OS.g_signal_connect(zoomGesture, OS.scale_changed, gestureZoom.getAddress(), this.handle);
- OS.g_signal_connect(zoomGesture, OS.begin, gestureBegin.getAddress(), this.handle);
- OS.g_signal_connect(zoomGesture, OS.end, gestureEnd.getAddress(), this.handle);
- return;
- }
+ zoomGesture = GTK.gtk_gesture_zoom_new(handle);
+ GTK.gtk_event_controller_set_propagation_phase (zoomGesture,
+ 2);
+ OS.g_signal_connect(zoomGesture, OS.scale_changed, gestureZoom.getAddress(), this.handle);
+ OS.g_signal_connect(zoomGesture, OS.begin, gestureBegin.getAddress(), this.handle);
+ OS.g_signal_connect(zoomGesture, OS.end, gestureEnd.getAddress(), this.handle);
+ return;
}
static Control getControl(long handle) {
@@ -6788,14 +6653,7 @@ long windowProc (long handle, long arg0, long user_data) {
Control control = findBackgroundControl ();
boolean draw = control != null && control.backgroundImage != null;
if (!draw && (state & CANVAS) != 0) {
- if (GTK.GTK_VERSION < OS.VERSION(3, 14, 0)) {
- GdkRGBA rgba = new GdkRGBA();
- long context = GTK.gtk_widget_get_style_context (handle);
- GTK.gtk_style_context_get_background_color (context, GTK.GTK_STATE_FLAG_NORMAL, rgba);
- draw = rgba.alpha == 0;
- } else {
- draw = (state & BACKGROUND) == 0;
- }
+ draw = (state & BACKGROUND) == 0;
}
if (draw) {
long cairo = arg0;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
index f04ea81dce..501daf7707 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java
@@ -1392,22 +1392,19 @@ void setBackgroundGdkRGBA (GdkRGBA rgba) {
void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) {
// We need to override here because DateTime widgets use "background" instead of
// "background-color" as their CSS property.
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- // Form background string
- String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
- : display.gtk_widget_get_name(handle);
- String css = name + " {background: " + display.gtk_rgba_to_css_string (rgba) + ";}\n" +
- name + ":selected" + " {background: " + display.gtk_rgba_to_css_string(display.COLOR_LIST_SELECTION_RGBA) + ";}";
+
+ // Form background string
+ String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
+ : display.gtk_widget_get_name(handle);
+ String css = name + " {background: " + display.gtk_rgba_to_css_string (rgba) + ";}\n" +
+ name + ":selected" + " {background: " + display.gtk_rgba_to_css_string(display.COLOR_LIST_SELECTION_RGBA) + ";}";
// Cache background
cssBackground = css;
// Apply background color and any cached foreground color
- String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
- gtk_css_provider_load_from_css (context, finalCss);
- } else {
- super.setBackgroundGdkRGBA(context, handle, rgba);
- }
+ String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
+ gtk_css_provider_load_from_css (context, finalCss);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index bb54220c30..cb0b3285a4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -513,7 +513,7 @@ public class Display extends Device {
/* GTK Version */
static final int GTK3_MAJOR = 3;
- static final int GTK3_MINOR = 10;
+ static final int GTK3_MINOR = 14;
static final int GTK3_MICRO = 0;
/* Display Data */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
index ce777b75db..e8800f74df 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
@@ -431,12 +431,8 @@ void reskinChildren (int flags) {
@Override
void setWidgetBackground () {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- GdkRGBA rgba = (state & BACKGROUND) != 0 ? getBackgroundGdkRGBA () : null;
- super.setBackgroundGdkRGBA (handle, rgba);
- } else {
- super.setWidgetBackground();
- }
+ GdkRGBA rgba = (state & BACKGROUND) != 0 ? getBackgroundGdkRGBA () : null;
+ super.setBackgroundGdkRGBA (handle, rgba);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
index 73387c316f..d1357dc60b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
@@ -152,30 +152,16 @@ Rectangle getClientAreaInPixels () {
@Override
GdkRGBA getContextColorGdkRGBA () {
- if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
- if (foreground != null) {
- return foreground;
- } else {
- return display.COLOR_WIDGET_FOREGROUND_RGBA;
- }
+ if (foreground != null) {
+ return foreground;
} else {
- return super.getContextColorGdkRGBA();
+ return display.COLOR_WIDGET_FOREGROUND_RGBA;
}
}
@Override
GdkRGBA getContextBackgroundGdkRGBA () {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- return super.getContextBackgroundGdkRGBA();
- } else {
- long context = GTK.gtk_widget_get_style_context (fixedHandle);
- GdkRGBA rgba = new GdkRGBA ();
- GTK.gtk_style_context_get_background_color (context, GTK.GTK_STATE_FLAG_NORMAL, rgba);
- if ((state & BACKGROUND) == 0) {
- return defaultBackground();
- }
- return rgba;
- }
+ return super.getContextBackgroundGdkRGBA();
}
@Override
@@ -338,10 +324,6 @@ void setFontDescription (long font) {
@Override
void setForegroundGdkRGBA (long handle, GdkRGBA rgba) {
- if (GTK.GTK_VERSION < OS.VERSION(3, 14, 0)) {
- super.setForegroundGdkRGBA(handle, rgba);
- return;
- }
/*
* When using CSS, setting the foreground color on an empty label
* widget prevents the background from being set. If a user wants
@@ -448,19 +430,15 @@ int setBounds(int x, int y, int width, int height, boolean move, boolean resize)
@Override
long paintHandle() {
- if (GTK.GTK_VERSION < OS.VERSION(3, 14, 0)) {
- return super.paintHandle();
- } else {
- if (GTK.GTK4) return clientHandle;
- long topHandle = topHandle ();
- /* we draw all our children on the clientHandle*/
- long paintHandle = clientHandle;
- while (paintHandle != topHandle) {
- if (gtk_widget_get_has_surface_or_window (paintHandle)) break;
- paintHandle = GTK.gtk_widget_get_parent (paintHandle);
- }
- return paintHandle;
+ if (GTK.GTK4) return clientHandle;
+ long topHandle = topHandle ();
+ /* we draw all our children on the clientHandle*/
+ long paintHandle = clientHandle;
+ while (paintHandle != topHandle) {
+ if (gtk_widget_get_has_surface_or_window (paintHandle)) break;
+ paintHandle = GTK.gtk_widget_get_parent (paintHandle);
}
+ return paintHandle;
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index 148a145f39..b95e3a2562 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -695,12 +695,8 @@ public void setText (String string) {
@Override
void setWidgetBackground () {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- GdkRGBA rgba = (state & BACKGROUND) != 0 ? getBackgroundGdkRGBA () : null;
- super.setBackgroundGdkRGBA (handle, rgba);
- } else {
- super.setWidgetBackground();
- }
+ GdkRGBA rgba = (state & BACKGROUND) != 0 ? getBackgroundGdkRGBA () : null;
+ super.setBackgroundGdkRGBA (handle, rgba);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
index 74d35d9347..1f08667135 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
@@ -401,16 +401,14 @@ long gtk_button_release_event (long widget, long event) {
@Override
long gtk_draw (long widget, long cairo) {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- long context = GTK.gtk_widget_get_style_context(widget);
- GtkAllocation allocation = new GtkAllocation();
- GTK.gtk_widget_get_allocation (widget, allocation);
- int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
- int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
- // We specify a 0 value for x & y as we want the whole widget to be
- // colored, not some portion of it.
- GTK.gtk_render_background(context, cairo, 0, 0, width, height);
- }
+ long context = GTK.gtk_widget_get_style_context(widget);
+ GtkAllocation allocation = new GtkAllocation();
+ GTK.gtk_widget_get_allocation (widget, allocation);
+ int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
+ int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
+ // We specify a 0 value for x & y as we want the whole widget to be
+ // colored, not some portion of it.
+ GTK.gtk_render_background(context, cairo, 0, 0, width, height);
return super.gtk_draw(widget, cairo);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index 5c82b3f469..881cbe6679 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -1231,7 +1231,7 @@ public void remove (int [] indices) {
/**
* Removes all of the items from the receiver.
- *
+ *
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
@@ -1509,12 +1509,8 @@ public void setItems (String... items) {
@Override
void setForegroundGdkRGBA (GdkRGBA rgba) {
- if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
- GdkRGBA toSet = rgba == null ? display.COLOR_LIST_FOREGROUND_RGBA : rgba;
- setForegroundGdkRGBA (handle, toSet);
- } else {
- super.setForegroundGdkRGBA(rgba);
- }
+ GdkRGBA toSet = rgba == null ? display.COLOR_LIST_FOREGROUND_RGBA : rgba;
+ setForegroundGdkRGBA (handle, toSet);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
index 66013e2611..525fdb9d3d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
@@ -264,16 +264,6 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
break;
case SWT.RADIO:
- // NOTE: This test tries to derive version of Ubuntu, not GTK
- if (GTK.GTK_VERSION <= OS.VERSION (3, 10, 8)) {
- /*
- * Bug 549376 in Ubuntu < 14.10 with UBUNTU_MENUPROXY,
- * Ubuntu's Unity causes a crash when label of radio
- * button is empty. The workaround is to initialize
- * the label with a space.
- */
- buffer = new byte [] { ' ', 0 };
- }
/*
* Feature in GTK. In GTK, radio button must always be part of
* a radio button group. In a GTK radio group, one button is always
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
index 469219c049..ea42beca1d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
@@ -257,16 +257,14 @@ long gtk_button_release_event (long widget, long event) {
@Override
long gtk_draw (long widget, long cairo) {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- long context = GTK.gtk_widget_get_style_context(widget);
- GtkAllocation allocation = new GtkAllocation();
- GTK.gtk_widget_get_allocation (widget, allocation);
- int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
- int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
- // We specify a 0 value for x & y as we want the whole widget to be
- // colored, not some portion of it.
- GTK.gtk_render_background(context, cairo, 0, 0, width, height);
- }
+ long context = GTK.gtk_widget_get_style_context(widget);
+ GtkAllocation allocation = new GtkAllocation();
+ GTK.gtk_widget_get_allocation (widget, allocation);
+ int width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
+ int height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
+ // We specify a 0 value for x & y as we want the whole widget to be
+ // colored, not some portion of it.
+ GTK.gtk_render_background(context, cairo, 0, 0, width, height);
return super.gtk_draw(widget, cairo);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 2069a34b54..93c290689e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -790,9 +790,6 @@ void createHandle (int index) {
GTK.gtk_window_set_title (shellHandle, new byte [1]);
if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) == 0) {
gtk_container_set_border_width (shellHandle, 1);
- if (GTK.GTK_VERSION < OS.VERSION (3, 14, 0)) {
- GTK.gtk_widget_override_background_color (shellHandle, GTK.GTK_STATE_FLAG_NORMAL, new GdkRGBA());
- }
}
if ((style & SWT.TOOL) != 0) {
GTK.gtk_window_set_type_hint(shellHandle, GDK.GDK_WINDOW_TYPE_HINT_UTILITY);
@@ -2344,13 +2341,6 @@ public void setEnabled (boolean enabled) {
if (cursor != null) {
GDK.gdk_window_set_cursor (enableWindow, cursor.handle);
}
- /* 427776: we need to listen to all enter-notify-event signals to
- * see if this new GdkWindow has been added to a widget's internal
- * hash table, so when the GdkWindow is destroyed we can also remove
- * that reference. */
- if (enterNotifyEventFunc != null)
- enterNotifyEventId = OS.g_signal_add_emission_hook (enterNotifyEventSignalId, 0, enterNotifyEventFunc.getAddress (), enableWindow, 0);
-
GDK.gdk_window_set_user_data (enableWindow, parentHandle);
GDK.gdk_window_show (enableWindow);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
index 21d0e260b2..475bf14abc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
@@ -729,20 +729,16 @@ void reskinChildren (int flags) {
@Override
void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- // Form background string
- String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "notebook header" : "GtkNotebook.header";
- String css = name + " {background-color: " + display.gtk_rgba_to_css_string (rgba) + ";}";
+ // Form background string
+ String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "notebook header" : "GtkNotebook.header";
+ String css = name + " {background-color: " + display.gtk_rgba_to_css_string (rgba) + ";}";
// Cache background
cssBackground = css;
// Apply background color and any cached foreground color
- String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
- gtk_css_provider_load_from_css (context, finalCss);
- } else {
- GTK.gtk_widget_override_background_color (handle, GTK.GTK_STATE_FLAG_NORMAL, rgba);
- }
+ String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
+ gtk_css_provider_load_from_css (context, finalCss);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index f55ee94f6b..672ba8a90b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -1409,14 +1409,10 @@ GdkRGBA getContextBackgroundGdkRGBA () {
@Override
GdkRGBA getContextColorGdkRGBA () {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- if (foreground != null) {
- return foreground;
- } else {
- return display.COLOR_LIST_FOREGROUND_RGBA;
- }
+ if (foreground != null) {
+ return foreground;
} else {
- return super.getContextColorGdkRGBA ();
+ return display.COLOR_LIST_FOREGROUND_RGBA;
}
}
@@ -2302,7 +2298,7 @@ long gtk_draw (long widget, long cairo) {
* If the table was resized since the last paint, we ignore this draw request
* and queue another draw request so that the pixel cache is properly invalidated.
*/
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0) && ownerDraw && haveBoundsChanged) {
+ if (ownerDraw && haveBoundsChanged) {
GTK.gtk_widget_queue_draw(handle);
return 0;
}
@@ -2974,7 +2970,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
}
if (item != null) {
if (GTK.GTK_IS_CELL_RENDERER_TOGGLE (cell) ||
- ( (GTK.GTK_IS_CELL_RENDERER_PIXBUF (cell) || GTK.GTK_VERSION > OS.VERSION(3, 13, 0)) && (columnIndex != 0 || (style & SWT.CHECK) == 0))) {
+ ( (GTK.GTK_IS_CELL_RENDERER_PIXBUF (cell)) && (columnIndex != 0 || (style & SWT.CHECK) == 0))) {
drawFlags = (int)flags;
drawState = SWT.FOREGROUND;
long [] ptr = new long [1];
@@ -3405,21 +3401,16 @@ void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) {
background = rgba;
}
GdkRGBA selectedBackground = display.getSystemColor(SWT.COLOR_LIST_SELECTION).handle;
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView";
- String css = name + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
- + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView";
+ String css = name + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
+ + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
// Cache background color
cssBackground = css;
// Apply background color and any foreground color
- String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
- gtk_css_provider_load_from_css(context, finalCss);
- } else {
- super.setBackgroundGdkRGBA(context, handle, rgba);
- GTK.gtk_widget_override_background_color(handle, GTK.GTK_STATE_FLAG_SELECTED, selectedBackground);
- }
+ String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
+ gtk_css_provider_load_from_css(context, finalCss);
}
@Override
@@ -3505,13 +3496,9 @@ void setFontDescription (long font) {
@Override
void setForegroundGdkRGBA (GdkRGBA rgba) {
- if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
- foreground = rgba;
- GdkRGBA toSet = rgba == null ? display.COLOR_LIST_FOREGROUND_RGBA : rgba;
- setForegroundGdkRGBA (handle, toSet);
- } else {
- super.setForegroundGdkRGBA(rgba);
- }
+ foreground = rgba;
+ GdkRGBA toSet = rgba == null ? display.COLOR_LIST_FOREGROUND_RGBA : rgba;
+ setForegroundGdkRGBA (handle, toSet);
}
/**
@@ -3766,10 +3753,8 @@ void setParentGdkResource (Control child) {
} else {
long parentGdkWindow = eventWindow ();
GTK.gtk_widget_set_parent_window (child.topHandle(), parentGdkWindow);
- if (GTK.GTK_VERSION >= OS.VERSION(3, 10, 0)) {
- hasChildren = true;
- connectFixedHandleDraw();
- }
+ hasChildren = true;
+ connectFixedHandleDraw();
}
}
@@ -4235,7 +4220,7 @@ Point resizeCalculationsGTK3 (long widget, int width, int height) {
* In the error case, the SWT fixed which contains the table still resizes as expected,
* and the horizontal scrollbar is only partially visible so that it doesn't overlap with table headers.
*/
- if (widget == scrolledHandle && GTK.GTK_VERSION >= OS.VERSION(3, 14, 0) && getHeaderVisible()) {
+ if (widget == scrolledHandle && getHeaderVisible()) {
int hScrollBarHeight = hScrollBarWidth(); // this actually returns height
if (hScrollBarHeight > 0) {
sizes.y = Math.max(sizes.y, getHeaderHeight() + hScrollBarHeight + (getBorderWidth() * 2));
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index 40f22b9fef..c32ad27bf6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -774,19 +774,6 @@ void deregister () {
@Override
boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean [] consume) {
- /**
- * Drag detection on GTKText will not be done in SWT, but fully handled by GTK side.
- * Let GTK handle the DnD logic as it is inherent to that widget as of GTK3.14 and cannot
- * be removed without overriding it. It is better to take the signal from GTK and send it
- * back to SWT instead.
- */
- boolean isDraggable = (GTK.GTK_VERSION < OS.VERSION(3, 14, 0)) ? insideBlockSelection(x, y) : false;
- if (filter) {
- if (isDraggable && super.dragDetect (x, y, filter, dragOnTimeout, consume)) {
- if (consume != null) consume [0] = true;
- return true;
- }
- }
return false;
}
@@ -1886,48 +1873,6 @@ long imContext () {
return 0;
}
-
-private boolean insideBlockSelection (int x, int y) {
- int start = 0, end = 0;
- if ((style & SWT.SINGLE) != 0) {
- int [] s = new int [1], e = new int [1];
- GTK.gtk_editable_get_selection_bounds (handle, s, e);
- start = s [0];
- end = e [0];
- } else {
- byte [] s = new byte [ITER_SIZEOF], e = new byte [ITER_SIZEOF];
- GTK.gtk_text_buffer_get_selection_bounds (bufferHandle, s, e);
- start = GTK.gtk_text_iter_get_offset (s);
- end = GTK.gtk_text_iter_get_offset (e);
- }
- if (start != end) {
- if (end < start) {
- int temp = end;
- end = start;
- start = temp;
- }
- int position = -1;
- if ((style & SWT.SINGLE) != 0) {
- int [] index = new int [1];
- int [] trailing = new int [1];
- long layout = GTK.gtk_entry_get_layout (handle);
- OS.pango_layout_xy_to_index (layout, x * OS.PANGO_SCALE, y * OS.PANGO_SCALE, index, trailing);
- long ptr = OS.pango_layout_get_text (layout);
- position = (int)OS.g_utf8_pointer_to_offset (ptr, ptr + index[0]) + trailing[0];
- } else {
- byte [] p = new byte [ITER_SIZEOF];
- GTK.gtk_text_view_get_iter_at_location (handle, p, x, y);
- position = GTK.gtk_text_iter_get_offset (p);
- }
- if (start <= position && position < end) {
- return true;
- }
- }
- return false;
-}
-
-
-
/**
* Inserts a string.
* <p>
@@ -2246,14 +2191,10 @@ GdkRGBA getContextBackgroundGdkRGBA () {
@Override
GdkRGBA getContextColorGdkRGBA () {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- if (foreground != null) {
- return foreground;
- } else {
- return display.COLOR_WIDGET_FOREGROUND_RGBA;
- }
+ if (foreground != null) {
+ return foreground;
} else {
- return super.getContextColorGdkRGBA ();
+ return display.COLOR_WIDGET_FOREGROUND_RGBA;
}
}
@@ -2298,13 +2239,9 @@ void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) {
@Override
void setForegroundGdkRGBA (GdkRGBA rgba) {
- if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
- foreground = rgba;
- GdkRGBA toSet = rgba == null ? display.COLOR_WIDGET_FOREGROUND_RGBA : rgba;
- setForegroundGdkRGBA (handle, toSet);
- } else {
- super.setForegroundGdkRGBA(rgba);
- }
+ foreground = rgba;
+ GdkRGBA toSet = rgba == null ? display.COLOR_WIDGET_FOREGROUND_RGBA : rgba;
+ setForegroundGdkRGBA (handle, toSet);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
index 22c51802f6..143fedda87 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
@@ -591,20 +591,16 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
@Override
void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- // Form background string
- String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "toolbar" : "GtkToolbar";
- String css = name + " {background-color: " + display.gtk_rgba_to_css_string(rgba) + "}";
+ // Form background string
+ String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "toolbar" : "GtkToolbar";
+ String css = name + " {background-color: " + display.gtk_rgba_to_css_string(rgba) + "}";
// Cache background color
this.cssBackground = css;
// Apply background color and any foreground color
- String finalCss = display.gtk_css_create_css_color_string (this.cssBackground, this.cssForeground, SWT.BACKGROUND);
- gtk_css_provider_load_from_css(context, finalCss);
- } else {
- super.setBackgroundGdkRGBA(context, handle, rgba);
- }
+ String finalCss = display.gtk_css_create_css_color_string (this.cssBackground, this.cssForeground, SWT.BACKGROUND);
+ gtk_css_provider_load_from_css(context, finalCss);
}
@Override
@@ -615,32 +611,28 @@ void setParentBackground () {
@Override
void setForegroundGdkRGBA (long handle, GdkRGBA rgba) {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- GdkRGBA toSet = new GdkRGBA();
- if (rgba != null) {
- toSet = rgba;
- } else {
- toSet = display.COLOR_WIDGET_FOREGROUND_RGBA;
- }
- long context = GTK.gtk_widget_get_style_context (handle);
- // Form foreground string
- String color = display.gtk_rgba_to_css_string(toSet);
- String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
- : display.gtk_widget_get_name(handle);
- GdkRGBA selectedForeground = display.COLOR_LIST_SELECTION_TEXT_RGBA;
- String selection = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? " selection" : ":selected";
- String css = "* {color: " + color + ";}\n"
- + name + selection + " {color: " + display.gtk_rgba_to_css_string(selectedForeground) + ";}";
+ GdkRGBA toSet = new GdkRGBA();
+ if (rgba != null) {
+ toSet = rgba;
+ } else {
+ toSet = display.COLOR_WIDGET_FOREGROUND_RGBA;
+ }
+ long context = GTK.gtk_widget_get_style_context (handle);
+ // Form foreground string
+ String color = display.gtk_rgba_to_css_string(toSet);
+ String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
+ : display.gtk_widget_get_name(handle);
+ GdkRGBA selectedForeground = display.COLOR_LIST_SELECTION_TEXT_RGBA;
+ String selection = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? " selection" : ":selected";
+ String css = "* {color: " + color + ";}\n"
+ + name + selection + " {color: " + display.gtk_rgba_to_css_string(selectedForeground) + ";}";
// Cache foreground color
this.cssForeground = css;
// Apply foreground color and any cached background color
- String finalCss = display.gtk_css_create_css_color_string (this.cssBackground, this.cssForeground, SWT.FOREGROUND);
- gtk_css_provider_load_from_css(context, finalCss);
- } else {
- super.setForegroundGdkRGBA(handle, rgba);
- }
+ String finalCss = display.gtk_css_create_css_color_string (this.cssBackground, this.cssForeground, SWT.FOREGROUND);
+ gtk_css_provider_load_from_css(context, finalCss);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index 9bcb423845..0a8f962372 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -1049,28 +1049,18 @@ void setBackgroundRGBA (GdkRGBA rgba) {
}
void setBackgroundRGBA (long handle, GdkRGBA rgba) {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- // Form background string
- long context = GTK.gtk_widget_get_style_context(handle);
- String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
- : display.gtk_widget_get_name(handle);
- String css = name + " {background-color: " + display.gtk_rgba_to_css_string(rgba) + "}";
+ // Form background string
+ long context = GTK.gtk_widget_get_style_context(handle);
+ String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle)
+ : display.gtk_widget_get_name(handle);
+ String css = name + " {background-color: " + display.gtk_rgba_to_css_string(rgba) + "}";
// Apply background color and any foreground color
- gtk_css_provider_load_from_css(context, css);
- }
+ gtk_css_provider_load_from_css(context, css);
}
void setForegroundRGBA (long handle, GdkRGBA rgba) {
- if (GTK.GTK_VERSION < OS.VERSION(3, 14, 0)) {
- GdkRGBA selectedForeground = display.COLOR_LIST_SELECTION_TEXT_RGBA;
- GTK.gtk_widget_override_color (handle, GTK.GTK_STATE_FLAG_NORMAL, rgba);
- GTK.gtk_widget_override_color (handle, GTK.GTK_STATE_FLAG_SELECTED, selectedForeground);
- long context = GTK.gtk_widget_get_style_context (handle);
- GTK.gtk_style_context_invalidate (context);
- return;
- }
GdkRGBA toSet = new GdkRGBA();
if (rgba != null) {
toSet = rgba;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
index 1a6f659f8c..d152bbfe1b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
@@ -872,35 +872,31 @@ private void setTrackerBackground(boolean opaque) {
} else if (opaque == cachedBackgroundIsOpaque.booleanValue()) {
return;
}
- if (GTK.GTK_VERSION < OS.VERSION (3, 14, 0)) {
- GTK.gtk_widget_override_background_color (overlay, GTK.GTK_STATE_FLAG_NORMAL, new GdkRGBA());
+ String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "window" : "GtkWindow";
+ String css;
+ if (opaque) {
+ GTK.gtk_widget_set_opacity (overlay, 1.0);
+ css = name + " {background-color: rgb(0,0,0);}";
} else {
- String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "window" : "GtkWindow";
- String css;
- if (opaque) {
- GTK.gtk_widget_set_opacity (overlay, 1.0);
- css = name + " {background-color: rgb(0,0,0);}";
- } else {
- GTK.gtk_widget_set_opacity (overlay, 0.0);
- css = name + " { "
- + "border-top-color: transparent;"
- + "border-left-color: transparent;"
- + "border-right-color: transparent;"
- + "border-bottom-color: transparent;}";
- }
- long context = GTK.gtk_widget_get_style_context (overlay);
- if (provider == 0) {
- provider = GTK.gtk_css_provider_new ();
- GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- OS.g_object_unref (provider);
- }
- if (GTK.GTK4) {
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1);
- } else {
- GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
- }
- GTK.gtk_style_context_invalidate (context);
+ GTK.gtk_widget_set_opacity (overlay, 0.0);
+ css = name + " { "
+ + "border-top-color: transparent;"
+ + "border-left-color: transparent;"
+ + "border-right-color: transparent;"
+ + "border-bottom-color: transparent;}";
+ }
+ long context = GTK.gtk_widget_get_style_context (overlay);
+ if (provider == 0) {
+ provider = GTK.gtk_css_provider_new ();
+ GTK.gtk_style_context_add_provider (context, provider, GTK.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ OS.g_object_unref (provider);
+ }
+ if (GTK.GTK4) {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1);
+ } else {
+ GTK.gtk_css_provider_load_from_data (provider, Converter.wcsToMbcs (css, true), -1, null);
}
+ GTK.gtk_style_context_invalidate (context);
long region = Cairo.cairo_region_create ();
GTK.gtk_widget_shape_combine_region (overlay, region);
GTK.gtk_widget_input_shape_combine_region (overlay, region);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index 5b6e392a51..5e01ba1666 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -1480,14 +1480,10 @@ GdkRGBA getContextBackgroundGdkRGBA () {
@Override
GdkRGBA getContextColorGdkRGBA () {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- if (foreground != null) {
- return foreground;
- } else {
- return display.COLOR_LIST_FOREGROUND_RGBA;
- }
+ if (foreground != null) {
+ return foreground;
} else {
- return super.getContextColorGdkRGBA ();
+ return display.COLOR_LIST_FOREGROUND_RGBA;
}
}
@@ -2413,7 +2409,7 @@ long gtk_draw (long widget, long cairo) {
* If the tree was resized since the last paint, we ignore this draw request
* and queue another draw request so that the pixel cache is properly invalidated.
*/
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0) && ownerDraw && haveBoundsChanged) {
+ if (ownerDraw && haveBoundsChanged) {
GTK.gtk_widget_queue_draw(handle);
return 0;
}
@@ -3099,7 +3095,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr
}
if (item != null) {
if (GTK.GTK_IS_CELL_RENDERER_TOGGLE (cell) ||
- ( (GTK.GTK_IS_CELL_RENDERER_PIXBUF (cell) || GTK.GTK_VERSION > OS.VERSION(3, 13, 0)) && (columnIndex != 0 || (style & SWT.CHECK) == 0))) {
+ ( (GTK.GTK_IS_CELL_RENDERER_PIXBUF (cell)) && (columnIndex != 0 || (style & SWT.CHECK) == 0))) {
drawFlags = (int)flags;
drawState = SWT.FOREGROUND;
long [] ptr = new long [1];
@@ -3511,21 +3507,16 @@ void setBackgroundGdkRGBA (long context, long handle, GdkRGBA rgba) {
background = rgba;
}
GdkRGBA selectedBackground = display.getSystemColor(SWT.COLOR_LIST_SELECTION).handle;
- if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
- String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView";
- String css = name + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
- + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
+ String name = GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) ? "treeview" : "GtkTreeView";
+ String css = name + " {background-color: " + display.gtk_rgba_to_css_string(background) + ";}\n"
+ + name + ":selected {background-color: " + display.gtk_rgba_to_css_string(selectedBackground) + ";}";
// Cache background color
cssBackground = css;
// Apply background color and any foreground color
- String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
- gtk_css_provider_load_from_css(context, finalCss);
- } else {
- super.setBackgroundGdkRGBA(context, handle, rgba);
- GTK.gtk_widget_override_background_color(handle, GTK.GTK_STATE_FLAG_SELECTED, selectedBackground);
- }
+ String finalCss = display.gtk_css_create_css_color_string (cssBackground, cssForeground, SWT.BACKGROUND);
+ gtk_css_provider_load_from_css(context, finalCss);
}
@Override
@@ -3612,13 +3603,9 @@ void setFontDescription (long font) {
@Override
void setForegroundGdkRGBA (GdkRGBA rgba) {
- if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {
- foreground = rgba;
- GdkRGBA toSet = rgba == null ? display.COLOR_LIST_FOREGROUND_RGBA : rgba;
- setForegroundGdkRGBA (handle, toSet);
- } else {
- super.setForegroundGdkRGBA(rgba);
- }
+ foreground = rgba;
+ GdkRGBA toSet = rgba == null ? display.COLOR_LIST_FOREGROUND_RGBA : rgba;
+ setForegroundGdkRGBA (handle, toSet);
}
/**
@@ -3835,10 +3822,8 @@ void setParentGdkResource (Control child) {
} else {
long parentGdkWindow = eventWindow ();
GTK.gtk_widget_set_parent_window (child.topHandle(), parentGdkWindow);
- if (GTK.GTK_VERSION >= OS.VERSION(3, 10, 0)) {
- hasChildren = true;
- connectFixedHandleDraw();
- }
+ hasChildren = true;
+ connectFixedHandleDraw();
}
}
@@ -4214,7 +4199,7 @@ Point resizeCalculationsGTK3 (long widget, int width, int height) {
* In the error case, the SWT fixed which contains the tree still resizes as expected,
* and the horizontal scrollbar is only partially visible so that it doesn't overlap with tree headers.
*/
- if (widget == scrolledHandle && GTK.GTK_VERSION >= OS.VERSION(3, 14, 0) && getHeaderVisible()) {
+ if (widget == scrolledHandle && getHeaderVisible()) {
int hScrollBarHeight = hScrollBarWidth(); // this actually returns height
if (hScrollBarHeight > 0) {
sizes.y = Math.max(sizes.y, getHeaderHeight() + hScrollBarHeight + (getBorderWidth() * 2));

Back to the top