diff options
author | Alexander Kurtakov | 2020-03-12 16:36:42 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2020-03-12 17:18:26 +0000 |
commit | c5cd5196ce6d290ce29426b4d7e79435df4fcc4b (patch) | |
tree | fd205c105a267b793c34b0d6a52f74be7620a540 | |
parent | 0bd6474e4b257e49645b8086fbcae711f32581d8 (diff) | |
download | eclipse.platform.swt-c5cd5196ce6d290ce29426b4d7e79435df4fcc4b.tar.gz eclipse.platform.swt-c5cd5196ce6d290ce29426b4d7e79435df4fcc4b.tar.xz eclipse.platform.swt-c5cd5196ce6d290ce29426b4d7e79435df4fcc4b.zip |
Bug 561047 - Require Gtk 3.20+ as minimum
Remove code for old versions.
Change-Id: I0d1beaf87c24f96ed52ce326a1693fab855c3bd6
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
29 files changed, 162 insertions, 656 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 e6e700b59e..dfaec81c75 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 @@ -357,15 +357,10 @@ void dragEnd(long widget, long context){ } long pointer = GDK.gdk_get_pointer(display); long keyboard = GDK.gdk_device_get_associated_device(pointer); - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - long pointer_seat = GDK.gdk_device_get_seat(pointer); - long keyboard_seat = GDK.gdk_device_get_seat(keyboard); - GDK.gdk_seat_ungrab(pointer_seat); - GDK.gdk_seat_ungrab(keyboard_seat); - } else { - GDK.gdk_device_ungrab(pointer, GDK.GDK_CURRENT_TIME); - GDK.gdk_device_ungrab(keyboard, GDK.GDK_CURRENT_TIME); - } + long pointer_seat = GDK.gdk_device_get_seat(pointer); + long keyboard_seat = GDK.gdk_device_get_seat(keyboard); + GDK.gdk_seat_ungrab(pointer_seat); + GDK.gdk_seat_ungrab(keyboard_seat); int operation = DND.DROP_NONE; if (context != 0) { 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 32070a896a..290fff4233 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 @@ -494,64 +494,6 @@ fail: } #endif -#ifndef NO_gdk_1device_1grab -JNIEXPORT jint JNICALL GDK_NATIVE(gdk_1device_1grab) - (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jint arg2, jboolean arg3, jint arg4, jlong arg5, jint arg6) -{ - jint rc = 0; - GDK_NATIVE_ENTER(env, that, gdk_1device_1grab_FUNC); -/* - rc = (jint)gdk_device_grab((GdkDevice *)arg0, (GdkWindow *)arg1, arg2, (gboolean)arg3, (GdkEventMask)arg4, (GdkCursor *)arg5, (guint32)arg6); -*/ - { - GDK_LOAD_FUNCTION(fp, gdk_device_grab) - if (fp) { - rc = (jint)((jint (CALLING_CONVENTION*)(GdkDevice *, GdkWindow *, jint, gboolean, GdkEventMask, GdkCursor *, guint32))fp)((GdkDevice *)arg0, (GdkWindow *)arg1, arg2, (gboolean)arg3, (GdkEventMask)arg4, (GdkCursor *)arg5, (guint32)arg6); - } - } - GDK_NATIVE_EXIT(env, that, gdk_1device_1grab_FUNC); - return rc; -} -#endif - -#ifndef NO_gdk_1device_1manager_1get_1client_1pointer -JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1device_1manager_1get_1client_1pointer) - (JNIEnv *env, jclass that, jlong arg0) -{ - jlong rc = 0; - GDK_NATIVE_ENTER(env, that, gdk_1device_1manager_1get_1client_1pointer_FUNC); -/* - rc = (jlong)gdk_device_manager_get_client_pointer(arg0); -*/ - { - GDK_LOAD_FUNCTION(fp, gdk_device_manager_get_client_pointer) - if (fp) { - rc = (jlong)((jlong (CALLING_CONVENTION*)(jlong))fp)(arg0); - } - } - GDK_NATIVE_EXIT(env, that, gdk_1device_1manager_1get_1client_1pointer_FUNC); - return rc; -} -#endif - -#ifndef NO_gdk_1device_1ungrab -JNIEXPORT void JNICALL GDK_NATIVE(gdk_1device_1ungrab) - (JNIEnv *env, jclass that, jlong arg0, jint arg1) -{ - GDK_NATIVE_ENTER(env, that, gdk_1device_1ungrab_FUNC); -/* - gdk_device_ungrab((GdkDevice *)arg0, (guint32)arg1); -*/ - { - GDK_LOAD_FUNCTION(fp, gdk_device_ungrab) - if (fp) { - ((void (CALLING_CONVENTION*)(GdkDevice *, guint32))fp)((GdkDevice *)arg0, (guint32)arg1); - } - } - GDK_NATIVE_EXIT(env, that, gdk_1device_1ungrab_FUNC); -} -#endif - #ifndef NO_gdk_1device_1warp__JII JNIEXPORT void JNICALL GDK_NATIVE(gdk_1device_1warp__JII) (JNIEnv *env, jclass that, jlong arg0, jint arg1, jint arg2) @@ -638,26 +580,6 @@ JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1display_1get_1default_1seat) } #endif -#ifndef NO_gdk_1display_1get_1device_1manager -JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1display_1get_1device_1manager) - (JNIEnv *env, jclass that, jlong arg0) -{ - jlong rc = 0; - GDK_NATIVE_ENTER(env, that, gdk_1display_1get_1device_1manager_FUNC); -/* - rc = (jlong)gdk_display_get_device_manager((GdkDisplay *)arg0); -*/ - { - GDK_LOAD_FUNCTION(fp, gdk_display_get_device_manager) - if (fp) { - rc = (jlong)((jlong (CALLING_CONVENTION*)(GdkDisplay *))fp)((GdkDisplay *)arg0); - } - } - GDK_NATIVE_EXIT(env, that, gdk_1display_1get_1device_1manager_FUNC); - return rc; -} -#endif - #ifndef NO_gdk_1display_1get_1keymap JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1display_1get_1keymap) (JNIEnv *env, jclass that, jlong arg0) @@ -2993,42 +2915,6 @@ fail: } #endif -#ifndef NO_gdk_1window_1process_1all_1updates -JNIEXPORT void JNICALL GDK_NATIVE(gdk_1window_1process_1all_1updates) - (JNIEnv *env, jclass that) -{ - GDK_NATIVE_ENTER(env, that, gdk_1window_1process_1all_1updates_FUNC); -/* - gdk_window_process_all_updates(); -*/ - { - GDK_LOAD_FUNCTION(fp, gdk_window_process_all_updates) - if (fp) { - ((void (CALLING_CONVENTION*)())fp)(); - } - } - GDK_NATIVE_EXIT(env, that, gdk_1window_1process_1all_1updates_FUNC); -} -#endif - -#ifndef NO_gdk_1window_1process_1updates -JNIEXPORT void JNICALL GDK_NATIVE(gdk_1window_1process_1updates) - (JNIEnv *env, jclass that, jlong arg0, jboolean arg1) -{ - GDK_NATIVE_ENTER(env, that, gdk_1window_1process_1updates_FUNC); -/* - gdk_window_process_updates((GdkWindow *)arg0, (gboolean)arg1); -*/ - { - GDK_LOAD_FUNCTION(fp, gdk_window_process_updates) - if (fp) { - ((void (CALLING_CONVENTION*)(GdkWindow *, gboolean))fp)((GdkWindow *)arg0, (gboolean)arg1); - } - } - GDK_NATIVE_EXIT(env, that, gdk_1window_1process_1updates_FUNC); -} -#endif - #ifndef NO_gdk_1window_1raise JNIEXPORT void JNICALL GDK_NATIVE(gdk_1window_1raise) (JNIEnv *env, jclass that, jlong arg0) @@ -3942,24 +3828,6 @@ JNIEXPORT void JNICALL GTK_NATIVE(gtk_1adjustment_1set_1value) } #endif -#ifndef NO_gtk_1adjustment_1value_1changed -JNIEXPORT void JNICALL GTK_NATIVE(gtk_1adjustment_1value_1changed) - (JNIEnv *env, jclass that, jlong arg0) -{ - GTK_NATIVE_ENTER(env, that, gtk_1adjustment_1value_1changed_FUNC); -/* - gtk_adjustment_value_changed((GtkAdjustment *)arg0); -*/ - { - GTK_LOAD_FUNCTION(fp, gtk_adjustment_value_changed) - if (fp) { - ((void (CALLING_CONVENTION*)(GtkAdjustment *))fp)((GtkAdjustment *)arg0); - } - } - GTK_NATIVE_EXIT(env, that, gtk_1adjustment_1value_1changed_FUNC); -} -#endif - #ifndef NO_gtk_1bin_1get_1child JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1bin_1get_1child) (JNIEnv *env, jclass that, jlong arg0) @@ -4644,24 +4512,6 @@ JNIEXPORT void JNICALL GTK_NATIVE(gtk_1combo_1box_1set_1active) } #endif -#ifndef NO_gtk_1combo_1box_1set_1focus_1on_1click -JNIEXPORT void JNICALL GTK_NATIVE(gtk_1combo_1box_1set_1focus_1on_1click) - (JNIEnv *env, jclass that, jlong arg0, jboolean arg1) -{ - GTK_NATIVE_ENTER(env, that, gtk_1combo_1box_1set_1focus_1on_1click_FUNC); -/* - gtk_combo_box_set_focus_on_click((GtkComboBox *)arg0, (gboolean)arg1); -*/ - { - GTK_LOAD_FUNCTION(fp, gtk_combo_box_set_focus_on_click) - if (fp) { - ((void (CALLING_CONVENTION*)(GtkComboBox *, gboolean))fp)((GtkComboBox *)arg0, (gboolean)arg1); - } - } - GTK_NATIVE_EXIT(env, that, gtk_1combo_1box_1set_1focus_1on_1click_FUNC); -} -#endif - #ifndef NO_gtk_1combo_1box_1set_1wrap_1width JNIEXPORT void JNICALL GTK_NATIVE(gtk_1combo_1box_1set_1wrap_1width) (JNIEnv *env, jclass that, jlong arg0, jint arg1) @@ -7225,24 +7075,6 @@ fail: } #endif -#ifndef NO_gtk_1misc_1set_1alignment -JNIEXPORT void JNICALL GTK_NATIVE(gtk_1misc_1set_1alignment) - (JNIEnv *env, jclass that, jlong arg0, jfloat arg1, jfloat arg2) -{ - GTK_NATIVE_ENTER(env, that, gtk_1misc_1set_1alignment_FUNC); -/* - gtk_misc_set_alignment((GtkMisc *)arg0, (gfloat)arg1, (gfloat)arg2); -*/ - { - GTK_LOAD_FUNCTION(fp, gtk_misc_set_alignment) - if (fp) { - ((void (CALLING_CONVENTION*)(GtkMisc *, gfloat, gfloat))fp)((GtkMisc *)arg0, (gfloat)arg1, (gfloat)arg2); - } - } - GTK_NATIVE_EXIT(env, that, gtk_1misc_1set_1alignment_FUNC); -} -#endif - #ifndef NO_gtk_1native_1dialog_1run JNIEXPORT jint JNICALL GTK_NATIVE(gtk_1native_1dialog_1run) (JNIEnv *env, jclass that, jlong arg0) 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 4619a13ded..aecbde2d4c 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 @@ -57,9 +57,6 @@ char * GDK_nativeFunctionNames[] = { "gdk_1device_1get_1seat", "gdk_1device_1get_1surface_1at_1position", "gdk_1device_1get_1window_1at_1position", - "gdk_1device_1grab", - "gdk_1device_1manager_1get_1client_1pointer", - "gdk_1device_1ungrab", "gdk_1device_1warp__JII", "gdk_1device_1warp__JJII", "gdk_1display_1beep", @@ -67,7 +64,6 @@ char * GDK_nativeFunctionNames[] = { "gdk_1display_1get_1default", "gdk_1display_1get_1default_1group", "gdk_1display_1get_1default_1seat", - "gdk_1display_1get_1device_1manager", "gdk_1display_1get_1keymap", "gdk_1display_1get_1monitor", "gdk_1display_1get_1monitor_1at_1point", @@ -231,8 +227,6 @@ char * GDK_nativeFunctionNames[] = { "gdk_1window_1move", "gdk_1window_1move_1resize", "gdk_1window_1new", - "gdk_1window_1process_1all_1updates", - "gdk_1window_1process_1updates", "gdk_1window_1raise", "gdk_1window_1resize", "gdk_1window_1restack", @@ -337,7 +331,6 @@ char * GTK_nativeFunctionNames[] = { "gtk_1adjustment_1set_1page_1increment", "gtk_1adjustment_1set_1step_1increment", "gtk_1adjustment_1set_1value", - "gtk_1adjustment_1value_1changed", "gtk_1bin_1get_1child", "gtk_1border_1free", "gtk_1box_1new", @@ -393,7 +386,6 @@ char * GTK_nativeFunctionNames[] = { "gtk_1combo_1box_1popdown", "gtk_1combo_1box_1popup", "gtk_1combo_1box_1set_1active", - "gtk_1combo_1box_1set_1focus_1on_1click", "gtk_1combo_1box_1set_1wrap_1width", "gtk_1combo_1box_1text_1insert", "gtk_1combo_1box_1text_1new", @@ -584,7 +576,6 @@ char * GTK_nativeFunctionNames[] = { "gtk_1menu_1shell_1set_1take_1focus", "gtk_1menu_1tool_1button_1new", "gtk_1message_1dialog_1new", - "gtk_1misc_1set_1alignment", "gtk_1native_1dialog_1run", "gtk_1notebook_1get_1current_1page", "gtk_1notebook_1get_1scrollable", 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 09ce387c56..78cc5b721b 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 @@ -67,9 +67,6 @@ typedef enum { gdk_1device_1get_1seat_FUNC, gdk_1device_1get_1surface_1at_1position_FUNC, gdk_1device_1get_1window_1at_1position_FUNC, - gdk_1device_1grab_FUNC, - gdk_1device_1manager_1get_1client_1pointer_FUNC, - gdk_1device_1ungrab_FUNC, gdk_1device_1warp__JII_FUNC, gdk_1device_1warp__JJII_FUNC, gdk_1display_1beep_FUNC, @@ -77,7 +74,6 @@ typedef enum { gdk_1display_1get_1default_FUNC, gdk_1display_1get_1default_1group_FUNC, gdk_1display_1get_1default_1seat_FUNC, - gdk_1display_1get_1device_1manager_FUNC, gdk_1display_1get_1keymap_FUNC, gdk_1display_1get_1monitor_FUNC, gdk_1display_1get_1monitor_1at_1point_FUNC, @@ -241,8 +237,6 @@ typedef enum { gdk_1window_1move_FUNC, gdk_1window_1move_1resize_FUNC, gdk_1window_1new_FUNC, - gdk_1window_1process_1all_1updates_FUNC, - gdk_1window_1process_1updates_FUNC, gdk_1window_1raise_FUNC, gdk_1window_1resize_FUNC, gdk_1window_1restack_FUNC, @@ -335,7 +329,6 @@ typedef enum { gtk_1adjustment_1set_1page_1increment_FUNC, gtk_1adjustment_1set_1step_1increment_FUNC, gtk_1adjustment_1set_1value_FUNC, - gtk_1adjustment_1value_1changed_FUNC, gtk_1bin_1get_1child_FUNC, gtk_1border_1free_FUNC, gtk_1box_1new_FUNC, @@ -391,7 +384,6 @@ typedef enum { gtk_1combo_1box_1popdown_FUNC, gtk_1combo_1box_1popup_FUNC, gtk_1combo_1box_1set_1active_FUNC, - gtk_1combo_1box_1set_1focus_1on_1click_FUNC, gtk_1combo_1box_1set_1wrap_1width_FUNC, gtk_1combo_1box_1text_1insert_FUNC, gtk_1combo_1box_1text_1new_FUNC, @@ -582,7 +574,6 @@ typedef enum { gtk_1menu_1shell_1set_1take_1focus_FUNC, gtk_1menu_1tool_1button_1new_FUNC, gtk_1message_1dialog_1new_FUNC, - gtk_1misc_1set_1alignment_FUNC, gtk_1native_1dialog_1run_FUNC, gtk_1notebook_1get_1current_1page_FUNC, gtk_1notebook_1get_1scrollable_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java index f7b52841d0..1b262cb3ef 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java @@ -455,13 +455,6 @@ public class GDK extends OS { /* [GTK4 only, if-def'd in os.h] */ public static final native long gdk_surface_get_display(long surface); /** - * @method flags=dynamic - * @param display cast=(GdkDisplay *) - */ - public static final native long gdk_display_get_device_manager(long display); - /** @method flags=dynamic */ - public static final native long gdk_device_manager_get_client_pointer(long device_manager); - /** * @param device cast=(GdkDevice *) * @param win_x cast=(gint *) * @param win_y cast=(gint *) @@ -769,24 +762,6 @@ public class GDK extends OS { */ public static final native long gdk_pixbuf_scale_simple(long src, int dest_width, int dest_height, int interp_type); /** - * @method flags=dynamic - * @param device cast=(GdkDevice *) - * @param window cast=(GdkWindow *) - * @param owner_events cast=(gboolean) - * @param event_mask cast=(GdkEventMask) - * @param cursor cast=(GdkCursor *) - * @param time_ cast=(guint32) - */ - /* [GTK3 only, if-def'd in os.h; 3.20 deprecated, replaced] */ - public static final native int gdk_device_grab(long device, long window, int grab_ownership, boolean owner_events, int event_mask, long cursor, int time_); - /** - * @method flags=dynamic - * @param device cast=(GdkDevice *) - * @param time_ cast=(guint32) - */ - /* [GTK3; 3.20 deprecated] */ - public static final native void gdk_device_ungrab(long device, int time_); - /** * @param device cast=(GdkDevice *) */ public static final native long gdk_device_get_associated_device(long device); @@ -1188,18 +1163,6 @@ public class GDK extends OS { /** @param surface cast=(GdkSurface *) */ /* [GTK4 only, if-def'd in os.h] */ public static final native void gdk_surface_lower(long surface); - /** - * @method flags=dynamic - */ - /* [GTK3 only; 3.16 deprecated, replaced] */ - public static final native void gdk_window_process_all_updates(); - /** - * @method flags=dynamic - * @param window cast=(GdkWindow *) - * @param update_children cast=(gboolean) - */ - /* [GTK3 only, if-def'd in os.h; 3.16 deprecated, replaced] */ - public static final native void gdk_window_process_updates(long window, boolean update_children); /** @param window cast=(GdkWindow *) */ /* [GTK3 only, if-def'd in os.h] */ public static final native void gdk_window_raise(long window); @@ -1304,13 +1267,8 @@ public class GDK extends OS { public static final native void gdk_surface_show_unraised(long surface); public static long gdk_get_pointer (long display) { - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - long default_seat = GDK.gdk_display_get_default_seat(display); - return GDK.gdk_seat_get_pointer(default_seat); - } else { - long device_manager = GDK.gdk_display_get_device_manager(display); - return GDK.gdk_device_manager_get_client_pointer(device_manager); - } + long default_seat = GDK.gdk_display_get_default_seat(display); + return GDK.gdk_seat_get_pointer(default_seat); } } 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 ef79f63c3f..aad099a85d 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 @@ -369,12 +369,6 @@ public class GTK extends OS { * @param value cast=(gdouble) */ public static final native void gtk_adjustment_set_page_increment(long adjustment, double value); - /** - * @method flags=dynamic - * @param adjustment cast=(GtkAdjustment *) - * */ - /* [GTK2/GTK3; 3.18 deprecated, replaced] */ - public static final native void gtk_adjustment_value_changed(long adjustment); /** @param bin cast=(GtkBin *) */ public static final native long gtk_bin_get_child(long bin); /** @param border cast=(GtkBorder *) */ @@ -592,13 +586,6 @@ public class GTK extends OS { * @param color cast=(GdkRGBA *) */ public static final native void gtk_color_chooser_get_rgba(long chooser, GdkRGBA color); - /** - * @method flags=dynamic - * @param combo cast=(GtkComboBox *) - * @param val cast=(gboolean) - */ - /* [GTK2/GTK3; 3.20 deprecated, replaced] */ - public static final native void gtk_combo_box_set_focus_on_click(long combo, boolean val); public static final native long gtk_combo_box_text_new(); public static final native long gtk_combo_box_text_new_with_entry(); /** @@ -1596,14 +1583,6 @@ public class GTK extends OS { * @param arg cast=(const gchar *) */ public static final native long gtk_message_dialog_new(long parent, int flags, int type, int buttons, byte[] message_format, byte[] arg); - /** - * @method flags=dynamic - * @param misc cast=(GtkMisc *) - * @param xalign cast=(gfloat) - * @param yalign cast=(gfloat) - */ - /* [GTK3 only, if-def'd in os.h; 3.14 deprecated, replaced] */ - public static final native void gtk_misc_set_alignment(long misc, float xalign, float yalign); /** @param dialog cast=(GtkNativeDialog *) */ public static final native int gtk_native_dialog_run(long dialog); /** @param notebook cast=(GtkNotebook *) */ 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 aa68ff9105..51918b63db 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 @@ -665,7 +665,7 @@ protected void init () { long context = GTK.gtk_widget_get_style_context (shellHandle); if ("ppc64le".equals(System.getProperty("os.arch"))) { defaultFont = GTK.gtk_style_context_get_font (context, GTK.GTK_STATE_FLAG_NORMAL); - } else if (GTK.GTK_VERSION >= OS.VERSION(3, 18, 0)) { + } else { GTK.gtk_style_context_save(context); GTK.gtk_style_context_set_state(context, GTK.GTK_STATE_FLAG_NORMAL); if (GTK.GTK4) { @@ -675,9 +675,6 @@ protected void init () { } GTK.gtk_style_context_restore(context); defaultFont = defaultFontArray [0]; - } else { - GTK.gtk_style_context_get(context, GTK.GTK_STATE_FLAG_NORMAL, GTK.gtk_style_property_font, defaultFontArray, 0); - defaultFont = defaultFontArray [0]; } defaultFont = OS.pango_font_description_copy (defaultFont); Point dpi = getDPI(), screenDPI = getScreenDPI(); 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 1dbb41f72c..4223a23612 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 @@ -577,7 +577,7 @@ long gtk_draw (long widget, long cairo) { * The fix is to make the widget invisible to the user. Resizing widget later on to a larger size * makes the widget visible again in setBounds. See Bug 533469, Bug 531120. */ - if (GTK.GTK_VERSION >= OS.VERSION (3, 20, 0) && (state & ZERO_WIDTH) != 0 && (state & ZERO_HEIGHT) != 0) { + if ((state & ZERO_WIDTH) != 0 && (state & ZERO_HEIGHT) != 0) { if (GTK.gtk_widget_get_visible(widget)) GTK.gtk_widget_set_visible(widget, false); // Button and display should not be disposed after hiding widget if (isDisposed() || display == null || display.isDisposed()) error (SWT.ERROR_DEVICE_DISPOSED); @@ -793,13 +793,8 @@ void _setAlignment (int alignment) { gtk_box_set_child_packing (boxHandle, imageHandle, true, true, 0, GTK.GTK_PACK_START); } - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0)) { - gtk_label_set_align(labelHandle,0.0f,0.5f); - gtk_widget_set_align(imageHandle,GTK.GTK_ALIGN_START, GTK.GTK_ALIGN_CENTER); - } else { - GTK.gtk_misc_set_alignment (labelHandle, 0.0f, 0.5f); - GTK.gtk_misc_set_alignment (imageHandle, 0.0f, 0.5f); - } + gtk_label_set_align(labelHandle,0.0f,0.5f); + gtk_widget_set_align(imageHandle,GTK.GTK_ALIGN_START, GTK.GTK_ALIGN_CENTER); GTK.gtk_label_set_justify (labelHandle, GTK.GTK_JUSTIFY_LEFT); return; @@ -809,25 +804,15 @@ void _setAlignment (int alignment) { gtk_box_set_child_packing (boxHandle, labelHandle, true, true, 0, GTK.GTK_PACK_END); gtk_box_set_child_packing (boxHandle, imageHandle, true, true, 0, GTK.GTK_PACK_START); - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0)) { - gtk_label_set_align(labelHandle,0.0f,0.5f); - gtk_widget_set_align(imageHandle,GTK.GTK_ALIGN_END, GTK.GTK_ALIGN_CENTER); - } else { - GTK.gtk_misc_set_alignment (labelHandle, 0f, 0.5f); - GTK.gtk_misc_set_alignment (imageHandle, 1f, 0.5f); - } + gtk_label_set_align(labelHandle,0.0f,0.5f); + gtk_widget_set_align(imageHandle,GTK.GTK_ALIGN_END, GTK.GTK_ALIGN_CENTER); } else { gtk_box_set_child_packing (boxHandle, labelHandle, true, true, 0, GTK.GTK_PACK_END); gtk_box_set_child_packing (boxHandle, imageHandle, true, true, 0, GTK.GTK_PACK_START); - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0)) { - gtk_label_set_align(labelHandle,0.5f,0.5f); - gtk_widget_set_align(imageHandle,GTK.GTK_ALIGN_CENTER, GTK.GTK_ALIGN_CENTER); - } else { - GTK.gtk_misc_set_alignment (labelHandle, 0.5f, 0.5f); - GTK.gtk_misc_set_alignment (imageHandle, 0.5f, 0.5f); - } + gtk_label_set_align(labelHandle,0.5f,0.5f); + gtk_widget_set_align(imageHandle,GTK.GTK_ALIGN_CENTER, GTK.GTK_ALIGN_CENTER); GTK.gtk_label_set_justify (labelHandle, GTK.GTK_JUSTIFY_CENTER); } return; @@ -841,13 +826,8 @@ void _setAlignment (int alignment) { gtk_box_set_child_packing (boxHandle, imageHandle, true, true, 0, GTK.GTK_PACK_START); } - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0)) { - gtk_label_set_align(labelHandle,1.0f,0.5f); - gtk_widget_set_align(imageHandle,GTK.GTK_ALIGN_END, GTK.GTK_ALIGN_CENTER); - } else { - GTK.gtk_misc_set_alignment (labelHandle, 1.0f, 0.5f); - GTK.gtk_misc_set_alignment (imageHandle, 1.0f, 0.5f); - } + gtk_label_set_align(labelHandle,1.0f,0.5f); + gtk_widget_set_align(imageHandle,GTK.GTK_ALIGN_END, GTK.GTK_ALIGN_CENTER); GTK.gtk_label_set_justify (labelHandle, GTK.GTK_JUSTIFY_RIGHT); return; } @@ -979,16 +959,6 @@ void setForegroundGdkRGBA (GdkRGBA rgba) { setForegroundGdkRGBA (fixedHandle, rgba); if (labelHandle != 0) setForegroundGdkRGBA (labelHandle, rgba); if (imageHandle != 0) setForegroundGdkRGBA (imageHandle, rgba); - - /* - * Feature in GTK3: GtkCheckButton & its descendant GtkRadioButton are often invisible or - * very hard to see with certain themes that don't define an icon for Check/Radio buttons. - * Giving them a border color that matches the text color ensures consistent visibility - * across most themes. See bug 463733. - */ - if (GTK.GTK_VERSION < OS.VERSION (3, 16, 0) && (style & (SWT.CHECK | SWT.RADIO)) != 0) { - gtk_swt_set_border_color (rgba); - } } @Override @@ -1041,25 +1011,6 @@ void setForegroundGdkRGBA (long handle, GdkRGBA rgba) { gtk_css_provider_load_from_css(context, finalCss); } -private void gtk_swt_set_border_color (GdkRGBA rgba) { - String css_string = "* {\n"; - if (rgba != null) { - String css_color = display.gtk_rgba_to_css_string (rgba); - css_string += "border-color: " + css_color + ";\n"; - } - css_string += "}\n"; - - String finalCss; - - // 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); - gtk_css_provider_load_from_css (context, finalCss); -} - /** * Sets the grayed state of the receiver. This state change * only applies if the control was created with the SWT.CHECK diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java index 34227dc069..b33ac018f7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java @@ -345,25 +345,23 @@ void scrollInPixels (int destX, int destY, int x, int y, int width, int height, * location the scrollbars are re-painted when scrolling, causing the * hopping effect. See bug 480458. */ - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0)) { - long hBarHandle = 0; - long vBarHandle = 0; - if (GTK.GTK_IS_SCROLLED_WINDOW(scrolledHandle)) { - hBarHandle = GTK.gtk_scrolled_window_get_hscrollbar (scrolledHandle); - vBarHandle = GTK.gtk_scrolled_window_get_vscrollbar (scrolledHandle); - } - GtkRequisition requisition = new GtkRequisition(); - if (hBarHandle != 0) { - gtk_widget_get_preferred_size (hBarHandle, requisition); - if (requisition.height > 0) { - srcRect.y = y - requisition.height; - } + long hBarHandle = 0; + long vBarHandle = 0; + if (GTK.GTK_IS_SCROLLED_WINDOW(scrolledHandle)) { + hBarHandle = GTK.gtk_scrolled_window_get_hscrollbar (scrolledHandle); + vBarHandle = GTK.gtk_scrolled_window_get_vscrollbar (scrolledHandle); + } + GtkRequisition requisition = new GtkRequisition(); + if (hBarHandle != 0) { + gtk_widget_get_preferred_size (hBarHandle, requisition); + if (requisition.height > 0) { + srcRect.y = y - requisition.height; } - if (vBarHandle != 0) { - gtk_widget_get_preferred_size (vBarHandle, requisition); - if (requisition.width > 0) { - srcRect.x = x - requisition.width; - } + } + if (vBarHandle != 0) { + gtk_widget_get_preferred_size (vBarHandle, requisition); + if (requisition.width > 0) { + srcRect.x = x - requisition.width; } } srcRect.width = width; @@ -449,9 +447,7 @@ void scrollInPixels (int destX, int destY, int x, int y, int width, int height, * Due to overlay drawing of scrollbars current method of scrolling leaves scrollbar and notifiers for them inside the canvas * after scroll. Fix is to redraw once done. */ - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0)) { - redraw(false); - } + redraw(false); } @Override 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 2965b08f0b..f7a6b52986 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 @@ -581,7 +581,7 @@ void createHandle (int index) { * Find the arrowHandle, which is the handle belonging to the GtkIcon * drop down arrow. See bug 539367. */ - if ((style & SWT.READ_ONLY) != 0 && GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { + if ((style & SWT.READ_ONLY) != 0) { if (cellBoxHandle != 0) arrowHandle = findArrowHandle(); } // In GTK 3 font description is inherited from parent widget which is not how SWT has always worked, @@ -699,23 +699,21 @@ long findButtonHandle() { * GtkBox has to be retrieved first. * As it's internal child one can't get it in other way. */ - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GTK.gtk_container_forall(handle, display.allChildrenProc, 0); - if (display.allChildren != 0) { - long list = display.allChildren; - while (list != 0) { - long widget = OS.g_list_data(list); - if (widget != 0) { - childHandle = widget; - break; - } - list = OS.g_list_next(list); + GTK.gtk_container_forall(handle, display.allChildrenProc, 0); + if (display.allChildren != 0) { + long list = display.allChildren; + while (list != 0) { + long widget = OS.g_list_data(list); + if (widget != 0) { + childHandle = widget; + break; } - OS.g_list_free(display.allChildren); - display.allChildren = 0; + list = OS.g_list_next(list); } - buttonBoxHandle = childHandle; + OS.g_list_free(display.allChildren); + display.allChildren = 0; } + buttonBoxHandle = childHandle; GTK.gtk_container_forall (childHandle, display.allChildrenProc, 0); if (display.allChildren != 0) { @@ -736,7 +734,7 @@ long findButtonHandle() { long findArrowHandle() { long result = 0; - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) && cellBoxHandle != 0) { + if (cellBoxHandle != 0) { GTK.gtk_container_forall (cellBoxHandle, display.allChildrenProc, 0); if (display.allChildren != 0) { long list = display.allChildren; @@ -1485,7 +1483,7 @@ void adjustChildClipping (long widget) { * This ensures the text never draws longer than the Combo itself. * See bug 539367. */ - if (widget == cellHandle && (style & SWT.READ_ONLY) != 0 && GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) && !unselected) { + if (widget == cellHandle && (style & SWT.READ_ONLY) != 0 && !unselected) { /* * Set "fit-model" mode for READ_ONLY Combos on GTK3.20+ to false. * This means the GtkCellView rendering the text can be set to @@ -1524,21 +1522,19 @@ long gtk_draw (long widget, long cairo) { * An additional fix was implemented to support non-READ_ONLY Combos, as well * as the case when one Composite has multiple Combos within it -- see bug 535323. */ - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - long parentHandle = GTK.gtk_widget_get_parent(fixedHandle); - if (parentHandle != 0) { - if (parent.fixClipHandle == 0) parent.fixClipHandle = parentHandle; - if (firstDraw) { - if ((style & SWT.READ_ONLY) != 0) { - long [] array = {fixedHandle, handle, buttonBoxHandle, buttonHandle, cellBoxHandle, cellHandle}; - parent.fixClipMap.put(this, array); - } else { - long [] array = {fixedHandle, handle, entryHandle, buttonBoxHandle, buttonHandle}; - parent.fixClipMap.put(this, array); - } - firstDraw = false; - GTK.gtk_widget_queue_draw(parentHandle); + long parentHandle = GTK.gtk_widget_get_parent(fixedHandle); + if (parentHandle != 0) { + if (parent.fixClipHandle == 0) parent.fixClipHandle = parentHandle; + if (firstDraw) { + if ((style & SWT.READ_ONLY) != 0) { + long [] array = {fixedHandle, handle, buttonBoxHandle, buttonHandle, cellBoxHandle, cellHandle}; + parent.fixClipMap.put(this, array); + } else { + long [] array = {fixedHandle, handle, entryHandle, buttonBoxHandle, buttonHandle}; + parent.fixClipMap.put(this, array); } + firstDraw = false; + GTK.gtk_widget_queue_draw(parentHandle); } } return super.gtk_draw(widget, cairo); @@ -1592,17 +1588,9 @@ long gtk_event_after (long widget, long gdkEvent) { focusIn[0] = gdkEventFocus.in != 0; } if (focusIn[0]) { - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GTK.gtk_widget_set_focus_on_click(handle, false); - } else { - GTK.gtk_combo_box_set_focus_on_click (handle, false); - } + GTK.gtk_widget_set_focus_on_click(handle, false); } else { - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GTK.gtk_widget_set_focus_on_click(handle, true); - } else { - GTK.gtk_combo_box_set_focus_on_click (handle, true); - } + GTK.gtk_widget_set_focus_on_click(handle, true); } } break; @@ -1808,13 +1796,9 @@ long paintWindow () { * The only direct child of GtkComboBox since 3.20 is GtkBox thus the children * have to be traversed to get to the entry one. */ - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - do { - window = OS.g_list_data (children); - } while ((children = OS.g_list_next (children)) != 0); - } else { + do { window = OS.g_list_data (children); - } + } while ((children = OS.g_list_next (children)) != 0); } OS.g_list_free (children); @@ -1833,13 +1817,9 @@ long paintSurface () { * The only direct child of GtkComboBox since 3.20 is GtkBox thus the children * have to be traversed to get to the entry one. */ - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - do { - surface = OS.g_list_data (children); - } while ((children = OS.g_list_next (children)) != 0); - } else { + do { surface = OS.g_list_data (children); - } + } while ((children = OS.g_list_next (children)) != 0); } OS.g_list_free (children); @@ -2328,9 +2308,7 @@ void setInitialBounds () { GTK.gtk_widget_size_allocate (topHandle, allocation, -1); } else { // Prevent GTK+ allocation warnings, preferred size should be retrieved before setting allocation size. - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GTK.gtk_widget_get_preferred_size(topHandle, null, null); - } + GTK.gtk_widget_get_preferred_size(topHandle, null, null); GTK.gtk_widget_set_allocation(topHandle, allocation); } } else { 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 ae82cf7f2d..4c625c0b33 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 @@ -445,11 +445,9 @@ long gtk_draw (long widget, long cairo) { // 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(); - } + // 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 06b62d2bd7..dce460fbfe 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 @@ -644,9 +644,7 @@ public boolean print (GC gc) { GtkAllocation allocation = new GtkAllocation (); GTK.gtk_widget_get_allocation(topHandle, allocation); // Prevent allocation warnings - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GTK.gtk_widget_get_preferred_size(topHandle, null, null); - } + GTK.gtk_widget_get_preferred_size(topHandle, null, null); GTK.gtk_widget_size_allocate(topHandle, allocation); GTK.gtk_widget_draw(topHandle, gc.handle); return true; @@ -1063,19 +1061,17 @@ Point resizeCalculationsGTK3 (long widget, int width, int height) { * elements which we cannot access. If the to-be-allocated size minus * these elements is < 0, allocate the preferred size instead. See bug 486068. */ - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GtkRequisition minimumSize = new GtkRequisition(); - GtkRequisition naturalSize = new GtkRequisition(); - GTK.gtk_widget_get_preferred_size(widget, minimumSize, naturalSize); - /* - * Use the smallest of the minimum/natural sizes to prevent oversized - * widgets. - */ - int smallestWidth = Math.min(minimumSize.width, naturalSize.width); - int smallestHeight = Math.min(minimumSize.height, naturalSize.height); - sizes.x = (width - (smallestWidth - width)) < 0 ? smallestWidth : width; - sizes.y = (height - (smallestHeight - height)) < 0 ? smallestHeight : height; - } + GtkRequisition minimumSize = new GtkRequisition(); + GtkRequisition naturalSize = new GtkRequisition(); + GTK.gtk_widget_get_preferred_size(widget, minimumSize, naturalSize); + /* + * Use the smallest of the minimum/natural sizes to prevent oversized + * widgets. + */ + int smallestWidth = Math.min(minimumSize.width, naturalSize.width); + int smallestHeight = Math.min(minimumSize.height, naturalSize.height); + sizes.x = (width - (smallestWidth - width)) < 0 ? smallestWidth : width; + sizes.y = (height - (smallestHeight - height)) < 0 ? smallestHeight : height; return sizes; } @@ -1191,9 +1187,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize GTK.gtk_widget_size_allocate (topHandle, allocation, -1); } else { // Prevent GTK+ allocation warnings, preferred size should be retrieved before setting allocation size. - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GTK.gtk_widget_get_preferred_size(topHandle, null, null); - } + GTK.gtk_widget_get_preferred_size(topHandle, null, null); GTK.gtk_widget_size_allocate (topHandle, allocation); } } @@ -3101,15 +3095,12 @@ long getFontDescription () { } else if (GTK.GTK4) { GTK.gtk_style_context_get(context, GTK.gtk_style_property_font, fontDesc, 0); return fontDesc [0]; - } else if (GTK.GTK_VERSION >= OS.VERSION(3, 18, 0)) { + } else { GTK.gtk_style_context_save(context); GTK.gtk_style_context_set_state(context, GTK.GTK_STATE_FLAG_NORMAL); GTK.gtk_style_context_get(context, GTK.GTK_STATE_FLAG_NORMAL, GTK.gtk_style_property_font, fontDesc, 0); GTK.gtk_style_context_restore(context); return fontDesc [0]; - } else { - GTK.gtk_style_context_get(context, GTK.GTK_STATE_FLAG_NORMAL, GTK.gtk_style_property_font, fontDesc, 0); - return fontDesc [0]; } } @@ -3360,13 +3351,13 @@ Point getThickness (long widget) { int xthickness = 0, ythickness = 0; GtkBorder tmp = new GtkBorder(); long context = GTK.gtk_widget_get_style_context (widget); - int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(widget); + int state_flag = GTK.gtk_widget_get_state_flags(widget); gtk_style_context_get_padding(context, state_flag, tmp); GTK.gtk_style_context_save (context); GTK.gtk_style_context_add_class (context, GTK.GTK_STYLE_CLASS_FRAME); xthickness += tmp.left; ythickness += tmp.top; - int state = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(widget); + int state = GTK.gtk_widget_get_state_flags(widget); gtk_style_context_get_border (context, state, tmp); xthickness += tmp.left; ythickness += tmp.top; @@ -5430,9 +5421,7 @@ void setInitialBounds () { GTK.gtk_widget_size_allocate (topHandle, allocation, -1); } else { // Prevent GTK+ allocation warnings, preferred size should be retrieved before setting allocation size. - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GTK.gtk_widget_get_preferred_size(topHandle, null, null); - } + GTK.gtk_widget_get_preferred_size(topHandle, null, null); GTK.gtk_widget_size_allocate (topHandle, allocation); } } else { @@ -5449,7 +5438,7 @@ void setInitialBounds () { * @return {@code false} by default on modern GTK 3 versions (3.20+). */ boolean mustBeVisibleOnInitBounds() { - return GTK.GTK_VERSION < OS.VERSION(3, 20, 0); + return false; } /* @@ -6619,13 +6608,6 @@ void update (boolean all, boolean flush) { if (!GTK.gtk_widget_get_realized (handle)) return; long window = paintWindow (); if (flush) display.flushExposes (window, all); - /* - * Do not send expose events on GTK 3.16.0+ - * It's worth checking whether can be removed on all GTK 3 versions. - */ - if (GTK.GTK_VERSION < OS.VERSION(3, 16, 0)) { - GDK.gdk_window_process_updates (window, all); - } } void updateBackgroundMode () { 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 501daf7707..d430711368 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 @@ -362,14 +362,14 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) { int xborder = 0, yborder = 0; GtkBorder tmp = new GtkBorder (); long context = GTK.gtk_widget_get_style_context (GTK.GTK4 ? spinButtonHandle :textEntryHandle); - int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(textEntryHandle); + int state_flag = GTK.gtk_widget_get_state_flags(textEntryHandle); gtk_style_context_get_padding(context, state_flag, tmp); trim.x -= tmp.left; trim.y -= tmp.top; trim.width += tmp.left + tmp.right; trim.height += tmp.top + tmp.bottom; if ((style & SWT.BORDER) != 0) { - int state = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(textEntryHandle); + int state = GTK.gtk_widget_get_state_flags(textEntryHandle); gtk_style_context_get_border(context, state, tmp); trim.x -= tmp.left; trim.y -= tmp.top; @@ -410,9 +410,6 @@ void createHandle () { createHandleForDateTime (); } GTK.gtk_editable_set_editable (textEntryHandle, (style & SWT.READ_ONLY) == 0); - if (GTK.GTK_VERSION <= OS.VERSION(3, 20, 0)) { - GTK.gtk_entry_set_has_frame (textEntryHandle, (style & SWT.BORDER) != 0); - } } } @@ -1694,28 +1691,7 @@ void setBoundsInPixels (int x, int y, int width, int height) { GTK.gtk_widget_set_size_request (sizingHandle, (newWidth >= 0) ? newWidth : 0, oldHeight); } - /* - * TAG_GTK_CALENDAR_VERTICAL_FILL_WORKAROUND_394534 - * Work around a GtkCalendar bug in GTK3: - * https://bugzilla.gnome.org/show_bug.cgi?id=737670 - * - * In GTK3.0 - 3.14.2 (but not Gtk2) if the calendar is expanded beyond a certain size, - * (e.g in the case of 'Vertical fill' in ControlExample, then the days shift down - * and they become un-selectable. e.g, see screen shot: - * https://bug737670.bugzilla-attachments.gnome.org/attachment.cgi?id=287470 - * - * To work around this, if gtk 3.0 - 3.14.2 is used, do not allow the calendar to expand beyond it's preffered - * native height. - */ - int fixedGtkVersion = OS.VERSION (3, 14, 2); - if (isCalendar () && (GTK.GTK_VERSION < fixedGtkVersion)) { - int calendarPrefferedVerticalSize = computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT, true).y; - if (height > calendarPrefferedVerticalSize) { - height = calendarPrefferedVerticalSize; - } - } super.setBoundsInPixels (x, y, width, height); - } /** @@ -1749,7 +1725,7 @@ GtkBorder getGtkBorderPadding () { GtkBorder gtkBorderPadding = new GtkBorder (); long contextHandle = GTK.GTK4 ? spinButtonHandle : textEntryHandle; long context = GTK.gtk_widget_get_style_context (contextHandle); - int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(contextHandle); + int state_flag = GTK.gtk_widget_get_state_flags(contextHandle); gtk_style_context_get_padding(context, state_flag, gtkBorderPadding); return gtkBorderPadding; } 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 29110ff1e5..b77327e9f2 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 @@ -3234,13 +3234,11 @@ GdkRGBA styleContextGetColor(long context, int flag) { GdkRGBA rgba = new GdkRGBA (); if (GTK.GTK4) { GTK.gtk_style_context_get_color(context, rgba); - } else if (GTK.GTK_VERSION >= OS.VERSION(3, 18, 0)) { + } else { GTK.gtk_style_context_save(context); GTK.gtk_style_context_set_state(context, flag); GTK.gtk_style_context_get_color (context, flag, rgba); GTK.gtk_style_context_restore(context); - } else { - GTK.gtk_style_context_get_color (context, flag, rgba); } return rgba; } @@ -5825,13 +5823,6 @@ static int untranslateKey (int key) { public void update () { checkDevice (); flushExposes (0, true); - /* - * Do not send expose events on GTK 3.16.0+ - * It's worth checking whether can be removed on all GTK 3 versions. - */ - if (GTK.GTK_VERSION < OS.VERSION(3, 16, 0)) { - GDK.gdk_window_process_all_updates (); - } } /** 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 d1357dc60b..707f2f3e48 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 @@ -308,15 +308,6 @@ void releaseWidget () { } @Override -void setBackgroundGdkRGBA(long handle, GdkRGBA rgba) { - if (GTK.GTK_VERSION >= OS.VERSION(3, 18, 0)) { - super.setBackgroundGdkRGBA(handle, rgba); - } else { - super.setBackgroundGdkRGBA(fixedHandle, rgba); - } -} - -@Override void setFontDescription (long font) { super.setFontDescription (font); setFontDescription (labelHandle, font); @@ -393,7 +384,7 @@ public void setText (String string) { GTK.gtk_frame_set_label_widget (handle, 0); } // Set the foreground now that the text has been set - if (GTK.GTK_VERSION >= OS.VERSION (3, 16, 0) && foreground != null) { + if (foreground != null) { setForegroundGdkRGBA (labelHandle, foreground); } } @@ -419,12 +410,8 @@ int setBounds(int x, int y, int width, int height, boolean move, boolean resize) * elements which we cannot access. If the to-be-allocated size minus * these elements is < 0, allocate the preferred size instead. */ - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - width = (width - (requisition.width - width)) < 0 ? requisition.width : width; - height = (height - (requisition.height - height)) < 0 ? requisition.height : height; - } else { - width = Math.max(requisition.width, width); - } + width = (width - (requisition.width - width)) < 0 ? requisition.width : width; + height = (height - (requisition.height - height)) < 0 ? requisition.height : height; return super.setBounds(x, y, width, height, move, resize); } 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 b95e3a2562..bc6a369f68 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 @@ -234,12 +234,12 @@ void createHandle (int index) { if ((style & SWT.SEPARATOR) != 0) { if ((style & SWT.HORIZONTAL)!= 0) { handle = GTK.gtk_separator_new (GTK.GTK_ORIENTATION_HORIZONTAL); - if (handle != 0 && GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { + if (handle != 0) { GTK.gtk_widget_set_valign(handle, GTK.GTK_ALIGN_CENTER); } } else { handle = GTK.gtk_separator_new (GTK.GTK_ORIENTATION_VERTICAL); - if (handle != 0 && GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { + if (handle != 0) { GTK.gtk_widget_set_halign(handle, GTK.GTK_ALIGN_CENTER); } } @@ -489,39 +489,24 @@ public void setAlignment (int alignment) { void setAlignment () { if ((style & SWT.LEFT) != 0) { - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0)) { - gtk_widget_set_align(labelHandle,GTK.GTK_ALIGN_START, GTK.GTK_ALIGN_START); //Aligns widget - gtk_label_set_align (0.0f, 0.0f); //Aligns text inside the widget. - gtk_widget_set_align(imageHandle, GTK.GTK_ALIGN_START, GTK.GTK_ALIGN_CENTER); - } else { - GTK.gtk_misc_set_alignment (labelHandle, 0.0f, 0.0f); - GTK.gtk_misc_set_alignment (imageHandle, 0.0f, 0.5f); - } + gtk_widget_set_align(labelHandle,GTK.GTK_ALIGN_START, GTK.GTK_ALIGN_START); //Aligns widget + gtk_label_set_align (0.0f, 0.0f); //Aligns text inside the widget. + gtk_widget_set_align(imageHandle, GTK.GTK_ALIGN_START, GTK.GTK_ALIGN_CENTER); GTK.gtk_label_set_justify (labelHandle, GTK.GTK_JUSTIFY_LEFT); return; } if ((style & SWT.CENTER) != 0) { - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0)) { - gtk_widget_set_align(labelHandle,GTK.GTK_ALIGN_CENTER, GTK.GTK_ALIGN_START); //Aligns widget - gtk_label_set_align (0.5f, 0.0f); //Aligns text inside the widget. - gtk_widget_set_align(imageHandle, GTK.GTK_ALIGN_CENTER, GTK.GTK_ALIGN_CENTER); - } else { - GTK.gtk_misc_set_alignment (labelHandle, 0.5f, 0.0f); - GTK.gtk_misc_set_alignment (imageHandle, 0.5f, 0.5f); - } + gtk_widget_set_align(labelHandle,GTK.GTK_ALIGN_CENTER, GTK.GTK_ALIGN_START); //Aligns widget + gtk_label_set_align (0.5f, 0.0f); //Aligns text inside the widget. + gtk_widget_set_align(imageHandle, GTK.GTK_ALIGN_CENTER, GTK.GTK_ALIGN_CENTER); GTK.gtk_label_set_justify (labelHandle, GTK.GTK_JUSTIFY_CENTER); return; } if ((style & SWT.RIGHT) != 0) { - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0)) { - gtk_widget_set_align(labelHandle,GTK.GTK_ALIGN_END, GTK.GTK_ALIGN_START); //Aligns widget. - gtk_label_set_align (1.0f, 0.0f); //Aligns text inside the widget. - gtk_widget_set_align(imageHandle, GTK.GTK_ALIGN_END, GTK.GTK_ALIGN_CENTER); - } else { - GTK.gtk_misc_set_alignment (labelHandle, 1.0f, 0.0f); - GTK.gtk_misc_set_alignment (imageHandle, 1.0f, 0.5f); - } + gtk_widget_set_align(labelHandle,GTK.GTK_ALIGN_END, GTK.GTK_ALIGN_START); //Aligns widget. + gtk_label_set_align (1.0f, 0.0f); //Aligns text inside the widget. + gtk_widget_set_align(imageHandle, GTK.GTK_ALIGN_END, GTK.GTK_ALIGN_CENTER); GTK.gtk_label_set_justify (labelHandle, GTK.GTK_JUSTIFY_RIGHT); return; } 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 525fdb9d3d..e7b35fd42b 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 @@ -353,12 +353,8 @@ void createHandle (int index) { GTK.gtk_widget_show (imageHandle); } if (labelHandle != 0) { - if (GTK.GTK_VERSION >= OS.VERSION (3, 16, 0)) { - GTK.gtk_label_set_xalign (labelHandle, 0); - GTK.gtk_widget_set_halign (labelHandle, GTK.GTK_ALIGN_FILL); - } else { - GTK.gtk_misc_set_alignment(labelHandle, 0, 0); - } + GTK.gtk_label_set_xalign (labelHandle, 0); + GTK.gtk_widget_set_halign (labelHandle, GTK.GTK_ALIGN_FILL); gtk_box_pack_end (boxHandle, labelHandle, true, true, 0); GTK.gtk_widget_show (labelHandle); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java index 90f681cec8..7dc654d885 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java @@ -192,10 +192,8 @@ long gtk_realize (long widget) { */ @Override Point resizeCalculationsGTK3 (long widget, int width, int height) { - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - // avoid warnings in GTK caused by too narrow progress bars - width = Math.max(2, width); - } + // avoid warnings in GTK caused by too narrow progress bars + width = Math.max(2, width); return new Point (width, height); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java index 60ec9c039a..d5ed689e13 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java @@ -381,7 +381,7 @@ Point resizeCalculationsGTK3(long widget, int width, int height) { * Due to the parent SwtFixed, the scale widget can still be resized below this minimum size. * Instead of shrinking to comply with the too-small size, parts of it are hidden. */ - if (widget == handle && GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { + if (widget == handle) { GtkRequisition naturalSize = new GtkRequisition(); GtkRequisition minimumSize = new GtkRequisition(); GTK.gtk_widget_get_preferred_size(handle, minimumSize, naturalSize); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java index 340cdedfd2..55ec88c925 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java @@ -913,13 +913,6 @@ public void setValues (int selection, int minimum, int maximum, int thumb, int i OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); GTK.gtk_adjustment_configure(adjustmentHandle, adjustment.value, adjustment.lower, adjustment.upper, adjustment.step_increment, adjustment.page_increment, adjustment.page_size); - /* - * gtk_adujustment_value_changed is deprecated on GTK3.18+. - * GTK+ will emit "value-changed" itself whenever the value changes. - * See bug 495413. - */ - if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) - GTK.gtk_adjustment_value_changed (adjustmentHandle); OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java index 2344fbe300..bd6c98d64a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java @@ -282,7 +282,7 @@ public ScrollBar getHorizontalBar () { */ public int getScrollbarsMode () { checkWidget(); - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0) && GTK.gtk_scrolled_window_get_overlay_scrolling(scrolledHandle)) { + if (GTK.gtk_scrolled_window_get_overlay_scrolling(scrolledHandle)) { return SWT.SCROLLBAR_OVERLAY; } return SWT.NONE; @@ -317,8 +317,7 @@ long gtk_draw (long widget, long cairo) { * of a redraw is the same region that the scroll bars occupy, and ignore * draw events that target such cases. See bug 546248. */ - boolean overlayScrolling = !OS.GTK_OVERLAY_SCROLLING_DISABLED && - GTK.GTK_VERSION >= OS.VERSION(3, 16, 0); + boolean overlayScrolling = !OS.GTK_OVERLAY_SCROLLING_DISABLED; if (overlayScrolling && OS.G_OBJECT_TYPE(widget) == OS.swt_fixed_get_type()) { if ((style & SWT.V_SCROLL) != 0 && verticalBar != null) { GtkAllocation verticalBarAlloc = new GtkAllocation(); @@ -441,7 +440,7 @@ boolean setScrollBarVisible (ScrollBar bar, boolean visible) { int [] hsp = new int [1], vsp = new int [1]; GTK.gtk_scrolled_window_get_policy (scrolledHandle, hsp, vsp); int policy = visible ? GTK.GTK_POLICY_ALWAYS : GTK.GTK_POLICY_NEVER; - if (GTK.GTK_VERSION >= OS.VERSION(3, 16, 0) && !visible) { + if (!visible) { policy = GTK.GTK_POLICY_EXTERNAL; } if ((bar.style & SWT.HORIZONTAL) != 0) { @@ -567,9 +566,7 @@ private Point scrollBarSize(long scrollBarHandle) { * Calling gtk_widget_queue_resize() before querying the size * fixes this issue. */ - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GTK.gtk_widget_queue_resize (scrollBarHandle); - } + GTK.gtk_widget_queue_resize (scrollBarHandle); gtk_widget_get_preferred_size (scrollBarHandle, requisition); int [] padding = new int [1]; // Only GTK3 needs this, GTK4 has the size built-in via gtk_widget_get_preferred_size() 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 7ed32393bb..cfde9b447d 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 @@ -596,30 +596,28 @@ void bringToTop (boolean force) { OS.XSetInputFocus (xDisplay, xWindow, OS.RevertToParent, OS.CurrentTime); GDK.gdk_x11_display_error_trap_pop_ignored(gdkDisplay); } else { - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GTK.gtk_grab_add(shellHandle); - long gdkDisplay; - if (GTK.GTK4) { - gdkDisplay = GDK.gdk_surface_get_display(gdkResource); - } else { - gdkDisplay = GDK.gdk_window_get_display(gdkResource); - } - long seat = GDK.gdk_display_get_default_seat(gdkDisplay); - if (GTK.GTK4) { - GDK.gdk_surface_show(gdkResource); - } else { - GDK.gdk_window_show(gdkResource); - } - GDK.gdk_seat_grab(seat, gdkResource, GDK.GDK_SEAT_CAPABILITY_ALL, true, 0, 0, 0, 0); - /* - * Bug 541185: Hover over to open Javadoc popup will make the popup - * close instead of gaining focus due to an extra focus out signal sent - * after grabbing focus. This triggers SWT.Deactivate handler which closes the shell. - * Workaround is to ignore this focus out. - */ - grabbedFocus = true; - ignoreFocusOutAfterGrab = true; + GTK.gtk_grab_add(shellHandle); + long gdkDisplay; + if (GTK.GTK4) { + gdkDisplay = GDK.gdk_surface_get_display(gdkResource); + } else { + gdkDisplay = GDK.gdk_window_get_display(gdkResource); + } + long seat = GDK.gdk_display_get_default_seat(gdkDisplay); + if (GTK.GTK4) { + GDK.gdk_surface_show(gdkResource); + } else { + GDK.gdk_window_show(gdkResource); } + GDK.gdk_seat_grab(seat, gdkResource, GDK.GDK_SEAT_CAPABILITY_ALL, true, 0, 0, 0, 0); + /* + * Bug 541185: Hover over to open Javadoc popup will make the popup + * close instead of gaining focus due to an extra focus out signal sent + * after grabbing focus. This triggers SWT.Deactivate handler which closes the shell. + * Workaround is to ignore this focus out. + */ + grabbedFocus = true; + ignoreFocusOutAfterGrab = true; } } else { if (GTK.GTK4) { @@ -1112,11 +1110,9 @@ void forceResize (int width, int height) { allocation.height = height; // Call gtk_widget_get_preferred_size() on GTK 3.20+ to prevent warnings. // See bug 486068. - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - GtkRequisition minimumSize = new GtkRequisition (); - GtkRequisition naturalSize = new GtkRequisition (); - GTK.gtk_widget_get_preferred_size (vboxHandle, minimumSize, naturalSize); - } + GtkRequisition minimumSize = new GtkRequisition (); + GtkRequisition naturalSize = new GtkRequisition (); + GTK.gtk_widget_get_preferred_size (vboxHandle, minimumSize, naturalSize); /* * Bug 535075, 536153: On Wayland, we need to set the position of the GtkBox container * relative to the shellHandle to prevent window contents rendered with offset. @@ -3070,7 +3066,7 @@ void deregister () { } boolean requiresUngrab () { - return !OS.isX11() && GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) && (style & SWT.ON_TOP) != 0 && (style & SWT.NO_FOCUS) == 0; + return !OS.isX11() && (style & SWT.ON_TOP) != 0 && (style & SWT.NO_FOCUS) == 0; } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java index 096ec0fe58..21aca6316c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java @@ -610,13 +610,6 @@ public void setValues (int selection, int minimum, int maximum, int thumb, int i OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); GTK.gtk_adjustment_configure(hAdjustment, adjustment.value, adjustment.lower, adjustment.upper, adjustment.step_increment, adjustment.page_increment, adjustment.page_size); - /* - * gtk_adujustment_value_changed is deprecated on GTK3.18+. - * GTK+ will emit "value-changed" itself whenever the value changes. - * See bug 495413. - */ - if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) - GTK.gtk_adjustment_value_changed (hAdjustment); OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java index 78bfbc7853..e8f60258ad 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java @@ -255,10 +255,10 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) { Rectangle trim = super.computeTrimInPixels (x, y, width, height); GtkBorder tmp = new GtkBorder(); long context = GTK.gtk_widget_get_style_context (handle); - int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(handle); + int state_flag = GTK.gtk_widget_get_state_flags(handle); gtk_style_context_get_padding(context, state_flag, tmp); if ((style & SWT.BORDER) != 0) { - int state = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(handle); + int state = GTK.gtk_widget_get_state_flags(handle); gtk_style_context_get_border(context, state, tmp); trim.x -= tmp.left; trim.y -= tmp.top; @@ -318,9 +318,6 @@ void createHandle (int index) { entryHandle = textHandle; } GTK.gtk_editable_set_editable (GTK.GTK4 ? entryHandle : handle, (style & SWT.READ_ONLY) == 0); - if (GTK.GTK_VERSION <= OS.VERSION(3, 20, 0)) { - GTK.gtk_entry_set_has_frame (GTK.GTK4 ? entryHandle : handle, (style & SWT.BORDER) != 0); - } GTK.gtk_spin_button_set_wrap (handle, (style & SWT.WRAP) != 0); imContext = OS.imContextLast(); // In GTK 3 font description is inherited from parent widget which is not how SWT has always worked, 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 94f482debf..e4a4522994 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 @@ -2991,13 +2991,6 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr long path = GTK.gtk_tree_model_get_path (modelHandle, iter); GTK.gtk_tree_view_get_background_area (handle, path, columnHandle, rect); GTK.gtk_tree_path_free (path); - // A workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=459117 - if (cr != 0 && GTK.GTK_VERSION <= OS.VERSION(3, 14, 8)) { - GdkRectangle r2 = new GdkRectangle (); - GDK.gdk_cairo_get_clip_rectangle (cr, r2); - rect.x = r2.x; - rect.width = r2.width; - } if ((drawState & SWT.SELECTED) == 0) { if ((state & PARENT_BACKGROUND) != 0 || backgroundImage != null) { Control control = findBackgroundControl (); @@ -3046,10 +3039,6 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr Rectangle rect2 = DPIUtil.autoScaleDown(new Rectangle(rect.x, r.y, r.width, r.height)); // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); - - if (GTK.GTK_VERSION <= OS.VERSION(3, 14, 8)) { - rect.width = r.width; - } } else { Rectangle rect2 = DPIUtil.autoScaleDown(new Rectangle(rect.x, rect.y, rect.width, rect.height)); // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 @@ -3124,13 +3113,6 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr long path = GTK.gtk_tree_model_get_path (modelHandle, iter); GTK.gtk_tree_view_get_background_area (handle, path, columnHandle, rect); GTK.gtk_tree_path_free (path); - // A workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=459117 - if (cr != 0 && GTK.GTK_VERSION <= OS.VERSION(3, 14, 8)) { - GdkRectangle r2 = new GdkRectangle (); - GDK.gdk_cairo_get_clip_rectangle (cr, r2); - rect.x = r2.x; - rect.width = r2.width; - } ignoreSize = true; int [] contentX = new int [1], contentWidth = new int [1]; gtk_cell_renderer_get_preferred_size (cell, handle, contentWidth, null); @@ -3147,12 +3129,6 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr } imageWidth = bounds.width; } - // On gtk < 3.14.8 the clip rectangle does not have image area into clip rectangle - // need to adjust clip rectangle with image width - if (cr != 0 && GTK.GTK_VERSION <= OS.VERSION(3, 14, 8)) { - rect.x -= imageWidth; - rect.width +=imageWidth; - } contentX [0] -= imageWidth; contentWidth [0] += imageWidth; GC gc = getGC(cr); 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 38cd1e5f28..90bd707f7d 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 @@ -227,16 +227,12 @@ void createHandle (int index) { * We need to handle borders differently in GTK3.20+. GtkEntry without frame will have a blank background color. * So let's set border via css and override the background in this case to be COLOR_LIST_BACKGROUND. */ - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - if ((style & SWT.BORDER) == 0) { - GTK.gtk_entry_set_has_frame(handle, false); - long context = GTK.gtk_widget_get_style_context(handle); - String background = display.gtk_rgba_to_css_string(display.COLOR_LIST_BACKGROUND_RGBA); - gtk_css_provider_load_from_css(context, "entry {border: solid; background: " + background + ";}"); - GTK.gtk_style_context_invalidate(context); - } - } else { - GTK.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0); + if ((style & SWT.BORDER) == 0) { + GTK.gtk_entry_set_has_frame(handle, false); + long context = GTK.gtk_widget_get_style_context(handle); + String background = display.gtk_rgba_to_css_string(display.COLOR_LIST_BACKGROUND_RGBA); + gtk_css_provider_load_from_css(context, "entry {border: solid; background: " + background + ";}"); + GTK.gtk_style_context_invalidate(context); } GTK.gtk_entry_set_visibility (handle, (style & SWT.PASSWORD) == 0); float alignment = 0.0f; @@ -612,7 +608,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { // GtkSearchEntry have more padding than GtkEntry GtkBorder tmp = new GtkBorder(); long context = GTK.gtk_widget_get_style_context (handle); - int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(handle); + int state_flag = GTK.gtk_widget_get_state_flags(handle); gtk_style_context_get_padding(context, state_flag, tmp); width += tmp.left + tmp.right; } @@ -632,7 +628,7 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) { if ((style & SWT.SINGLE) != 0) { GtkBorder tmp = new GtkBorder(); long context = GTK.gtk_widget_get_style_context (handle); - int state_flag = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(handle); + int state_flag = GTK.gtk_widget_get_state_flags(handle); gtk_style_context_get_padding(context, state_flag, tmp); trim.x -= tmp.left; trim.y -= tmp.top; @@ -644,7 +640,7 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) { trim.height += tmp.top + tmp.bottom; } if ((style & SWT.BORDER) != 0) { - int state = GTK.GTK_VERSION < OS.VERSION(3, 18, 0) ? GTK.GTK_STATE_FLAG_NORMAL : GTK.gtk_widget_get_state_flags(handle); + int state = GTK.gtk_widget_get_state_flags(handle); gtk_style_context_get_border(context, state, tmp); trim.x -= tmp.left; trim.y -= tmp.top; 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 0a8f962372..894838e1a8 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 @@ -614,12 +614,8 @@ long gtk_create_menu_proxy (long widget) { long menuLabel = GTK.gtk_accel_label_new (label); if (menuLabel == 0) error (SWT.ERROR_NO_HANDLES); - if (GTK.GTK_VERSION >= OS.VERSION (3, 16, 0)) { - GTK.gtk_label_set_xalign (labelHandle, 0); - GTK.gtk_widget_set_halign (labelHandle, GTK.GTK_ALIGN_FILL); - } else { - GTK.gtk_misc_set_alignment(labelHandle, 0, 0); - } + GTK.gtk_label_set_xalign (labelHandle, 0); + GTK.gtk_widget_set_halign (labelHandle, GTK.GTK_ALIGN_FILL); long menuImage = GTK.gtk_image_new_from_pixbuf (pixbuf); if (menuImage == 0) error (SWT.ERROR_NO_HANDLES); @@ -1051,12 +1047,10 @@ void setBackgroundRGBA (GdkRGBA rgba) { void setBackgroundRGBA (long handle, GdkRGBA 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 name = display.gtk_widget_class_get_css_name(handle); String css = name + " {background-color: " + display.gtk_rgba_to_css_string(rgba) + "}"; - - // Apply background color and any foreground color + // Apply background color and any foreground color gtk_css_provider_load_from_css(context, css); } 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 3f0aa8ee5a..1599ded0d0 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 @@ -3235,13 +3235,6 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr long path = GTK.gtk_tree_model_get_path (modelHandle, iter); GTK.gtk_tree_view_get_background_area (handle, path, columnHandle, rect); GTK.gtk_tree_path_free (path); - // Use the x and width information from the Cairo context. See bug 535124 and 465309. - if (cr != 0 && GTK.GTK_VERSION <= OS.VERSION(3, 14, 8)) { - GdkRectangle r2 = new GdkRectangle (); - GDK.gdk_cairo_get_clip_rectangle (cr, r2); - rect.x = r2.x; - rect.width = r2.width; - } ignoreSize = true; int [] contentX = new int [1], contentWidth = new int [1]; gtk_cell_renderer_get_preferred_size (cell, handle, contentWidth, null); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java index 4e38e1f7a7..3df5993f39 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java @@ -1694,7 +1694,7 @@ public void setData (String key, Object value) { } } if (key.equals(SWT.SKIN_CLASS) || key.equals(SWT.SKIN_ID)) this.reskin(SWT.ALL); - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0) && key.equals(KEY_GTK_CSS) && value instanceof String) { + if (key.equals(KEY_GTK_CSS) && value instanceof String) { long context = GTK.gtk_widget_get_style_context (cssHandle()); long provider = GTK.gtk_css_provider_new(); if (context != 0 && provider != 0) { @@ -2053,27 +2053,17 @@ int gdk_pointer_grab (long gdkResource, int grab_ownership, boolean owner_events display = GDK.gdk_window_get_display (gdkResource); } } - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - long seat = GDK.gdk_display_get_default_seat(display); - if (gdkSeatGrabPrepareFunc == null) { - gdkSeatGrabPrepareFunc = new Callback(Widget.class, "GdkSeatGrabPrepareFunc", 3); //$NON-NLS-1$ - } - return GDK.gdk_seat_grab(seat, gdkResource, GDK.GDK_SEAT_CAPABILITY_ALL_POINTING, owner_events, cursor, 0, gdkSeatGrabPrepareFunc.getAddress(), gdkResource); - } else { - long pointer = GDK.gdk_get_pointer(display); - return GDK.gdk_device_grab (pointer, gdkResource, grab_ownership, owner_events, event_mask, cursor, time_); + long seat = GDK.gdk_display_get_default_seat(display); + if (gdkSeatGrabPrepareFunc == null) { + gdkSeatGrabPrepareFunc = new Callback(Widget.class, "GdkSeatGrabPrepareFunc", 3); //$NON-NLS-1$ } + return GDK.gdk_seat_grab(seat, gdkResource, GDK.GDK_SEAT_CAPABILITY_ALL_POINTING, owner_events, cursor, 0, gdkSeatGrabPrepareFunc.getAddress(), gdkResource); } void gdk_pointer_ungrab (long gdkResource, int time_) { long display = GTK.GTK4? GDK.gdk_surface_get_display(gdkResource) : GDK.gdk_window_get_display (gdkResource); - if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) { - long seat = GDK.gdk_display_get_default_seat(display); - GDK.gdk_seat_ungrab(seat); - } else { - long pointer = GDK.gdk_get_pointer(display); - GDK.gdk_device_ungrab (pointer, time_); - } + long seat = GDK.gdk_display_get_default_seat(display); + GDK.gdk_seat_ungrab(seat); } static long GdkSeatGrabPrepareFunc (long gdkSeat, long gdkResource, long userData_gdkResource) { |