summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-07-10 14:47:18 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-07-10 14:47:18 -0400
commit1b0efec7f406bf0ecdc0990ae0b3b3d5b035d6d3 (patch)
treed38aabd5d869b92a36687bfd66177776f310528a
parente3a2594d93baac57c5e342d2c7769e2b4dd79d71 (diff)
downloadeclipse.platform.swt-gtk_widget_sensitive.tar.gz
eclipse.platform.swt-gtk_widget_sensitive.tar.xz
eclipse.platform.swt-gtk_widget_sensitive.zip
Uses gtk_widget_get_sensitive instead of deprecated GTK_WIDGET_SENSITIVEgtk_widget_sensitive
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java13
9 files changed, 75 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 155872e3dd..2972a41754 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
@@ -15445,6 +15445,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 f21e8ca75a..61c00e7f6f 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
@@ -198,6 +198,7 @@
#define gtk_widget_is_composited_LIB LIB_GTK
#define gtk_widget_get_tooltip_text_LIB LIB_GTK
#define gtk_widget_set_tooltip_text_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
@@ -356,6 +357,9 @@
#else
#define GTK_SCROLLED_WINDOW_VSCROLLBAR(arg0) (arg0)->vscrollbar
#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
#define GTK_WIDGET_WIDTH(arg0) (arg0)->allocation.width
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 b8074eb1de..ad4a3572aa 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 = 1315;
-int OS_nativeFunctionCallCount[1315];
+int OS_nativeFunctionCount = 1316;
+int OS_nativeFunctionCallCount[1316];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -1228,6 +1228,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 75194be58b..673479403a 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
@@ -1236,6 +1236,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 0a5969cade..3d8f7eb726 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
@@ -1680,6 +1680,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 8bd103943e..0a4dbc0a51 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,11 @@ public MenuItem getDefaultItem () {
*/
public boolean getEnabled () {
checkWidget();
- return OS.GTK_WIDGET_SENSITIVE (handle);
+ if ((OS.GTK_VERSION >= OS.VERSION (2, 18, 0))) {
+ return OS.gtk_widget_get_sensitive(handle);
+ }else{
+ return OS.GTK_WIDGET_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 69f6ae0f87..470afa4b8a 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,12 @@ 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;
+ if ((OS.GTK_VERSION >= OS.VERSION (2, 18, 0))) {
+ enabled = OS.gtk_widget_get_sensitive (parentHandle);
+ }else{
+ enabled = OS.GTK_WIDGET_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 +351,11 @@ int /*long*/ getAccelGroup () {
*/
public boolean getEnabled () {
checkWidget();
- return OS.GTK_WIDGET_SENSITIVE (handle);
+ if ((OS.GTK_VERSION >= OS.VERSION (2, 18, 0))) {
+ return OS.gtk_widget_get_sensitive (handle);
+ }else{
+ return OS.GTK_WIDGET_SENSITIVE (handle);
+ }
}
/**
@@ -654,7 +663,11 @@ public void setAccelerator (int accelerator) {
*/
public void setEnabled (boolean enabled) {
checkWidget();
- if (OS.GTK_WIDGET_SENSITIVE (handle) == enabled) return;
+ if ((OS.GTK_VERSION >= OS.VERSION (2, 18, 0))) {
+ if (OS.gtk_widget_get_sensitive (handle) == enabled) return;
+ }else{
+ if (OS.GTK_WIDGET_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..9ab74ce8b3 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,11 @@ void destroyWidget () {
*/
public boolean getEnabled () {
checkWidget ();
- if (handle != 0) return OS.GTK_WIDGET_SENSITIVE (handle);
+ if ((OS.GTK_VERSION >= OS.VERSION (2, 18, 0))) {
+ if (handle != 0) return OS.gtk_widget_get_sensitive (handle);
+ }else{
+ if (handle != 0) return OS.GTK_WIDGET_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 8be8ddb1be..718b2e28af 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,12 @@ public Image getDisabledImage () {
public boolean getEnabled () {
checkWidget();
int /*long*/ topHandle = topHandle ();
- return OS.GTK_WIDGET_SENSITIVE (topHandle);
+ if ((OS.GTK_VERSION >= OS.VERSION (2, 18, 0))) {
+ return OS.gtk_widget_get_sensitive (topHandle);
+ }else{
+ return OS.GTK_WIDGET_SENSITIVE (topHandle);
+ }
+
}
/**
@@ -920,7 +925,11 @@ 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_VERSION >= OS.VERSION (2, 18, 0))) {
+ if (OS.gtk_widget_get_sensitive (topHandle) == enabled) return;
+ }else{
+ if (OS.GTK_WIDGET_SENSITIVE (topHandle) == enabled) return;
+ }
OS.gtk_widget_set_sensitive (topHandle, enabled);
if (enabled) {
/*