diff options
10 files changed, 53 insertions, 9 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 155d1a0b2c..7f2beecf4c 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 @@ -15542,6 +15542,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1parent_1window) } #endif +#ifndef NO__1gtk_1widget_1get_1sensitive +JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1get_1sensitive) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1sensitive_FUNC); +/* + rc = (jboolean)gtk_widget_get_sensitive(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_get_sensitive) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1sensitive_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1widget_1get_1size_1request JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1get_1size_1request) (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index 11a7ba3790..af4eb84880 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -205,6 +205,7 @@ #define gtk_widget_set_has_window_LIB LIB_GTK #define gtk_fixed_set_has_window_LIB LIB_GTK #define gtk_widget_get_mapped_LIB LIB_GTK +#define gtk_widget_get_sensitive_LIB LIB_GTK #define gdk_pango_context_set_colormap_LIB LIB_GDK #define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK #define gdk_x11_screen_lookup_visual_LIB LIB_GDK @@ -366,6 +367,9 @@ #ifndef GTK_WIDGET_HAS_DEFAULT #define GTK_WIDGET_HAS_DEFAULT(arg0) 0 #endif +#ifndef GTK_WIDGET_SENSITIVE +#define GTK_WIDGET_SENSITIVE(arg0) 0 +#endif #define GTK_WIDGET_HEIGHT(arg0) (arg0)->allocation.height #define GTK_WIDGET_SET_HEIGHT(arg0, arg1) (arg0)->allocation.height = arg1 #ifndef GTK_WIDGET_MAPPED 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 4468de2f88..010c8664f5 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 @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1320; -int OS_nativeFunctionCallCount[1320]; +int OS_nativeFunctionCount = 1321; +int OS_nativeFunctionCallCount[1321]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -1231,6 +1231,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1widget_1get_1pango_1context", "_1gtk_1widget_1get_1parent", "_1gtk_1widget_1get_1parent_1window", + "_1gtk_1widget_1get_1sensitive", "_1gtk_1widget_1get_1size_1request", "_1gtk_1widget_1get_1style", "_1gtk_1widget_1get_1tooltip_1text", 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 da5dd954ae..0f49d17c1b 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 @@ -1239,6 +1239,7 @@ typedef enum { _1gtk_1widget_1get_1pango_1context_FUNC, _1gtk_1widget_1get_1parent_FUNC, _1gtk_1widget_1get_1parent_1window_FUNC, + _1gtk_1widget_1get_1sensitive_FUNC, _1gtk_1widget_1get_1size_1request_FUNC, _1gtk_1widget_1get_1style_FUNC, _1gtk_1widget_1get_1tooltip_1text_FUNC, 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 b13bdeadd2..1e44962599 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 @@ -1681,6 +1681,16 @@ public static final boolean GTK_WIDGET_SENSITIVE(int /*long*/ wid) { lock.unlock(); } } +/** @method flags=dynamic */ +public static final native boolean _gtk_widget_get_sensitive(int /*long*/ widget); +public static final boolean gtk_widget_get_sensitive(int /*long*/ widget) { + lock.lock(); + try { + return _gtk_widget_get_sensitive(widget); + } finally { + lock.unlock(); + } +} public static final native void _GTK_WIDGET_SET_FLAGS(int /*long*/ wid, int flag); public static final void GTK_WIDGET_SET_FLAGS(int /*long*/ wid, int flag) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java index 70c058ee71..dfaa240880 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java @@ -419,7 +419,7 @@ public MenuItem getDefaultItem () { */ public boolean getEnabled () { checkWidget(); - return OS.GTK_WIDGET_SENSITIVE (handle); + return gtk_widget_get_sensitive (handle); } /** 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 5ea35ee1c4..9cf8c6bc89 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 @@ -275,7 +275,7 @@ void createHandle (int index) { OS.gtk_accel_label_set_accel_widget (label, 0); } int /*long*/ parentHandle = parent.handle; - boolean enabled = OS.GTK_WIDGET_SENSITIVE (parentHandle); + boolean enabled = gtk_widget_get_sensitive (parentHandle); if (!enabled) OS.GTK_WIDGET_SET_FLAGS (parentHandle, OS.GTK_SENSITIVE); OS.gtk_menu_shell_insert (parentHandle, handle, index); if (!enabled) OS.GTK_WIDGET_UNSET_FLAGS (parentHandle, OS.GTK_SENSITIVE); @@ -346,7 +346,7 @@ int /*long*/ getAccelGroup () { */ public boolean getEnabled () { checkWidget(); - return OS.GTK_WIDGET_SENSITIVE (handle); + return gtk_widget_get_sensitive (handle); } /** @@ -654,7 +654,7 @@ public void setAccelerator (int accelerator) { */ public void setEnabled (boolean enabled) { checkWidget(); - if (OS.GTK_WIDGET_SENSITIVE (handle) == enabled) return; + if (OS.gtk_widget_get_sensitive (handle) == enabled) return; int /*long*/ accelGroup = getAccelGroup (); if (accelGroup != 0) removeAccelerator (accelGroup); OS.gtk_widget_set_sensitive (handle, enabled); 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 77cc837b35..1551418956 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 @@ -176,7 +176,7 @@ void destroyWidget () { */ public boolean getEnabled () { checkWidget (); - if (handle != 0) return OS.GTK_WIDGET_SENSITIVE (handle); + if (handle != 0) return gtk_widget_get_sensitive (handle); return true; } 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 a68418e7d7..cc05d41a01 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 @@ -379,7 +379,7 @@ public Image getDisabledImage () { public boolean getEnabled () { checkWidget(); int /*long*/ topHandle = topHandle (); - return OS.GTK_WIDGET_SENSITIVE (topHandle); + return gtk_widget_get_sensitive (topHandle); } /** @@ -937,7 +937,7 @@ public void setDisabledImage (Image image) { public void setEnabled (boolean enabled) { checkWidget(); int /*long*/ topHandle = topHandle (); - if (OS.GTK_WIDGET_SENSITIVE (topHandle) == enabled) return; + if (OS.gtk_widget_get_sensitive (topHandle) == enabled) return; OS.gtk_widget_set_sensitive (topHandle, enabled); if (enabled) { /* 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 778e9bb987..6aa4be97f3 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 @@ -1682,6 +1682,14 @@ int /*long*/ sizeRequestProc (int /*long*/ handle, int /*long*/ arg0, int /*long return 0; } +boolean gtk_widget_get_sensitive (int /*long*/ widget) { + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + return OS.gtk_widget_get_sensitive (widget); + } else { + return OS.GTK_WIDGET_SENSITIVE (widget); + } +} + /** * Returns a string containing a concise, human-readable * description of the receiver. |