diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-07-10 11:21:19 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-08-01 09:36:46 -0400 |
commit | 2054549f26c019ff25e04cae93704a55f48e14ee (patch) | |
tree | 2a1daf91e1d7cd9b0ece2813d2b4111eed58d19f /bundles | |
parent | 3025d237f680a2e072fde4f6a213f48f2a5248fa (diff) | |
download | eclipse.platform.swt-2054549f26c019ff25e04cae93704a55f48e14ee.tar.gz eclipse.platform.swt-2054549f26c019ff25e04cae93704a55f48e14ee.tar.xz eclipse.platform.swt-2054549f26c019ff25e04cae93704a55f48e14ee.zip |
Use gtk_widget_has_default instead of deprecated GTK_WIDGET_HAS_DEFAULT
Diffstat (limited to 'bundles')
6 files changed, 49 insertions, 6 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..3be59b8a0c 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 @@ -15516,6 +15516,26 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1grab_1focus) } #endif +#ifndef NO__1gtk_1widget_1has_1default +JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1has_1default) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1has_1default_FUNC); +/* + rc = (jboolean)gtk_widget_has_default(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_has_default) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1has_1default_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1widget_1hide JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1hide) (JNIEnv *env, jclass that, jintLong arg0) 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..98f4109f34 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 @@ -197,6 +197,7 @@ #define gtk_window_set_skip_taskbar_hint_LIB LIB_GTK #define gtk_widget_is_composited_LIB LIB_GTK #define gtk_widget_get_tooltip_text_LIB LIB_GTK +#define gtk_widget_has_default_LIB LIB_GTK #define gtk_widget_set_tooltip_text_LIB LIB_GTK #define gdk_pango_context_set_colormap_LIB LIB_GDK #define gdk_x11_screen_get_window_manager_name_LIB LIB_GDK @@ -356,6 +357,9 @@ #else #define GTK_SCROLLED_WINDOW_VSCROLLBAR(arg0) (arg0)->vscrollbar #endif +#ifndef GTK_WIDGET_HAS_DEFAULT +#define GTK_WIDGET_HAS_DEFAULT(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..3164823a54 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", @@ -1233,6 +1233,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1widget_1get_1tooltip_1text", "_1gtk_1widget_1get_1toplevel", "_1gtk_1widget_1grab_1focus", + "_1gtk_1widget_1has_1default", "_1gtk_1widget_1hide", "_1gtk_1widget_1is_1composited", "_1gtk_1widget_1is_1focus", 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..bb05798aec 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 @@ -1241,6 +1241,7 @@ typedef enum { _1gtk_1widget_1get_1tooltip_1text_FUNC, _1gtk_1widget_1get_1toplevel_FUNC, _1gtk_1widget_1grab_1focus_FUNC, + _1gtk_1widget_1has_1default_FUNC, _1gtk_1widget_1hide_FUNC, _1gtk_1widget_1is_1composited_FUNC, _1gtk_1widget_1is_1focus_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..0d2d7ad24d 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 @@ -1653,6 +1653,16 @@ public static final boolean GTK_WIDGET_HAS_DEFAULT(int /*long*/ wid) { lock.unlock(); } } +/** @method flags=dynamic */ +public static final native boolean _gtk_widget_has_default(int /*long*/ widget); +public static final boolean gtk_widget_has_default(int /*long*/ widget) { + lock.lock(); + try { + return _gtk_widget_has_default(widget); + } finally { + lock.unlock(); + } +} public static final native boolean _GTK_WIDGET_HAS_FOCUS(int /*long*/ wid); public static final boolean GTK_WIDGET_HAS_FOCUS(int /*long*/ wid) { lock.lock(); 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 77d5d6b13d..3b3b35542e 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 @@ -492,10 +492,17 @@ int /*long*/ gtk_focus_in_event (int /*long*/ widget, int /*long*/ event) { int /*long*/ result = super.gtk_focus_in_event (widget, event); // widget could be disposed at this point if (handle == 0) return 0; - if ((style & SWT.PUSH) != 0 && OS.GTK_WIDGET_HAS_DEFAULT (handle)) { - Decorations menuShell = menuShell (); - menuShell.defaultButton = this; - } + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + if ((style & SWT.PUSH) != 0 && OS.gtk_widget_has_default(handle)) { + Decorations menuShell = menuShell (); + menuShell.defaultButton = this; + } + }else{ + if ((style & SWT.PUSH) != 0 && OS.GTK_WIDGET_HAS_DEFAULT (handle)) { + Decorations menuShell = menuShell (); + menuShell.defaultButton = this; + } + } return result; } |