diff options
author | Eric Williams | 2018-11-08 17:47:22 +0000 |
---|---|---|
committer | Eric Williams | 2018-11-08 17:52:12 +0000 |
commit | 65722792346a14add8d31f7c4fbedf035a34654e (patch) | |
tree | 0ddc889954cd3c053c3f2c8e1451fc6cffe4ccba | |
parent | 603fbdf71378d8376bc8eb7ee225150757d90fa5 (diff) | |
download | eclipse.platform.swt-65722792346a14add8d31f7c4fbedf035a34654e.tar.gz eclipse.platform.swt-65722792346a14add8d31f7c4fbedf035a34654e.tar.xz eclipse.platform.swt-65722792346a14add8d31f7c4fbedf035a34654e.zip |
Bug 540932: [GTK3] Remove GTK_ACCEL_LABEL macros
Remove GTK_ACCEL_LABEL_* macros and bump minimum version of GTK3 to 3.6.
Change-Id: I84ea40f53713940b6aec72457d882aeb51059c12
Signed-off-by: Eric Williams <ericwill@redhat.com>
7 files changed, 11 insertions, 65 deletions
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 2b2e90c7da..b99fb080ec 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 @@ -2573,28 +2573,6 @@ JNIEXPORT void JNICALL GDK_NATIVE(gdk_1threads_1leave) #define GTK_NATIVE(func) Java_org_eclipse_swt_internal_gtk_GTK_##func #endif -#ifndef NO_GTK_1ACCEL_1LABEL_1GET_1ACCEL_1STRING -JNIEXPORT jintLong JNICALL GTK_NATIVE(GTK_1ACCEL_1LABEL_1GET_1ACCEL_1STRING) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jintLong rc = 0; - GTK_NATIVE_ENTER(env, that, GTK_1ACCEL_1LABEL_1GET_1ACCEL_1STRING_FUNC); - rc = (jintLong)GTK_ACCEL_LABEL_GET_ACCEL_STRING((GtkAccelLabel *)arg0); - GTK_NATIVE_EXIT(env, that, GTK_1ACCEL_1LABEL_1GET_1ACCEL_1STRING_FUNC); - return rc; -} -#endif - -#ifndef NO_GTK_1ACCEL_1LABEL_1SET_1ACCEL_1STRING -JNIEXPORT void JNICALL GTK_NATIVE(GTK_1ACCEL_1LABEL_1SET_1ACCEL_1STRING) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) -{ - GTK_NATIVE_ENTER(env, that, GTK_1ACCEL_1LABEL_1SET_1ACCEL_1STRING_FUNC); - GTK_ACCEL_LABEL_SET_ACCEL_STRING((GtkAccelLabel *)arg0, (gchar *)arg1); - GTK_NATIVE_EXIT(env, that, GTK_1ACCEL_1LABEL_1SET_1ACCEL_1STRING_FUNC); -} -#endif - #ifndef NO_GTK_1TYPE_1TEXT_1VIEW_1ACCESSIBLE JNIEXPORT jintLong JNICALL GTK_NATIVE(GTK_1TYPE_1TEXT_1VIEW_1ACCESSIBLE) (JNIEnv *env, jclass that) 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 87fadcaa98..8d7d1694b7 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 @@ -231,8 +231,6 @@ JNIEXPORT jint JNICALL STATS_NATIVE(GDK_1GetFunctionCallCount) #ifdef NATIVE_STATS char * GTK_nativeFunctionNames[] = { - "GTK_1ACCEL_1LABEL_1GET_1ACCEL_1STRING", - "GTK_1ACCEL_1LABEL_1SET_1ACCEL_1STRING", "GTK_1TYPE_1TEXT_1VIEW_1ACCESSIBLE", "GTK_1WIDGET_1GET_1CLASS", "GtkAllocation_1sizeof", 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 3f279b26bb..ec44574bec 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 @@ -229,8 +229,6 @@ extern char* GTK_nativeFunctionNames[]; #endif typedef enum { - GTK_1ACCEL_1LABEL_1GET_1ACCEL_1STRING_FUNC, - GTK_1ACCEL_1LABEL_1SET_1ACCEL_1STRING_FUNC, GTK_1TYPE_1TEXT_1VIEW_1ACCESSIBLE_FUNC, GTK_1WIDGET_1GET_1CLASS_FUNC, GtkAllocation_1sizeof_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 2236ca1f4d..08dc0aaf57 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 @@ -248,14 +248,6 @@ public class GTK extends OS { /** @param widget cast=(GtkWidget *) */ public static final native long /*int*/ GTK_WIDGET_GET_CLASS(long /*int*/ widget); - - /** - * @param acce_label cast=(GtkAccelLabel *) - * @param string cast=(gchar *) - */ - public static final native void GTK_ACCEL_LABEL_SET_ACCEL_STRING(long /*int*/ acce_label, long /*int*/ string); - /** @param acce_label cast=(GtkAccelLabel *) */ - public static final native long /*int*/ GTK_ACCEL_LABEL_GET_ACCEL_STRING(long /*int*/ acce_label); /** @method flags=const */ public static final native long /*int*/ GTK_TYPE_TEXT_VIEW_ACCESSIBLE (); public static final native long /*int*/ _GTK_ACCESSIBLE (long /*int*/ handle); 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 6832310193..d3088096ed 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 @@ -468,7 +468,7 @@ public class Display extends Device { /* GTK Version */ static final int GTK3_MAJOR = 3; - static final int GTK3_MINOR = 4; + static final int GTK3_MINOR = 6; static final int GTK3_MICRO = 0; /* Display Data */ 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 9b69a2b9c2..39c65a5250 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 @@ -1049,15 +1049,11 @@ public void setText (String string) { if (labelHandle != 0 && GTK.GTK_IS_LABEL (labelHandle)) { GTK.gtk_label_set_text_with_mnemonic (labelHandle, buffer); if (GTK.GTK_IS_ACCEL_LABEL (labelHandle)) { - if (GTK.GTK_VERSION >= OS.VERSION(3, 6, 0)) { - MaskKeysym maskKeysym = getMaskKeysym(); - if (maskKeysym != null) { - GTK.gtk_accel_label_set_accel_widget (labelHandle, handle); - GTK.gtk_accel_label_set_accel (labelHandle, - maskKeysym.keysym, maskKeysym.mask); - } - } else { - setAccelLabel (labelHandle, accelString); + MaskKeysym maskKeysym = getMaskKeysym(); + if (maskKeysym != null) { + GTK.gtk_accel_label_set_accel_widget (labelHandle, handle); + GTK.gtk_accel_label_set_accel (labelHandle, + maskKeysym.keysym, maskKeysym.mask); } // A workaround for Ubuntu Unity global menu OS.g_signal_emit_by_name(handle, OS.accel_closures_changed); @@ -1065,15 +1061,6 @@ public void setText (String string) { } } -private void setAccelLabel(long /*int*/ label, String accelString) { - byte[] buffer = Converter.wcsToMbcs (accelString, true); - long /*int*/ ptr = OS.g_malloc (buffer.length); - C.memmove (ptr, buffer, buffer.length); - long /*int*/ oldPtr = GTK.GTK_ACCEL_LABEL_GET_ACCEL_STRING (label); - GTK.GTK_ACCEL_LABEL_SET_ACCEL_STRING (label, ptr); - if (oldPtr != 0) OS.g_free (oldPtr); -} - /** * Sets the receiver's tool tip text to the argument, which * may be null indicating that the default tool tip for the 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 88a638ec10..4834e47fd9 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 @@ -1580,18 +1580,11 @@ long /*int*/ gtk_key_press_event (long /*int*/ widget, long /*int*/ event) { @Override long /*int*/ gtk_size_allocate (long /*int*/ widget, long /*int*/ allocation) { int width, height; - if (GTK.GTK_VERSION >= OS.VERSION(3, 6, 0)) { - int[] widthA = new int [1]; - int[] heightA = new int [1]; - GTK.gtk_window_get_size(shellHandle, widthA, heightA); - width = widthA[0]; - height = heightA[0]; - } else { - GtkAllocation widgetAllocation = new GtkAllocation (); - GTK.gtk_widget_get_allocation (shellHandle, widgetAllocation); - width = widgetAllocation.width; - height = widgetAllocation.height; - } + int[] widthA = new int [1]; + int[] heightA = new int [1]; + GTK.gtk_window_get_size(shellHandle, widthA, heightA); + width = widthA[0]; + height = heightA[0]; // Bug 474235: on Wayland gtk_size_allocate() is called more frequently, causing an // infinitely recursive resize call. This causes non-resizable Shells/Dialogs to |