diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-07 14:17:06 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-08-07 14:17:06 -0400 |
commit | bc551e2d95f836a4a16b35255ead09efc7b47b54 (patch) | |
tree | 6aee8941c7d0b43dcdfd4b21ae4d2108235ef9a6 | |
parent | a187354d39a8bd0bfd0b035b8db41e0943d6b46f (diff) | |
download | eclipse.platform.swt-gtk_widget_unset_flags.tar.gz eclipse.platform.swt-gtk_widget_unset_flags.tar.xz eclipse.platform.swt-gtk_widget_unset_flags.zip |
Omit use of deprecated GTK_WIDGET_UNSET_FLAGSgtk_widget_unset_flags
13 files changed, 133 insertions, 14 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..1d5f789743 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 @@ -15688,6 +15688,26 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1app_1paintable) } #endif +#ifndef NO__1gtk_1widget_1set_1can_1focus +JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1set_1can_1focus) + (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1set_1can_1focus_FUNC); +/* + rc = (jboolean)gtk_widget_set_can_focus(arg0, arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_set_can_focus) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong, jboolean))fp)(arg0, arg1); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1set_1can_1focus_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1widget_1set_1default_1direction JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1default_1direction) (JNIEnv *env, jclass that, jint arg0) @@ -15742,6 +15762,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1parent_1window) } #endif +#ifndef NO__1gtk_1widget_1set_1receives_1default +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1receives_1default) + (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1set_1receives_1default_FUNC); +/* + gtk_widget_set_receives_default(arg0, arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_set_receives_default) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jboolean))fp)(arg0, arg1); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1set_1receives_1default_FUNC); +} +#endif + #ifndef NO__1gtk_1widget_1set_1redraw_1on_1allocate JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1redraw_1on_1allocate) (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1) @@ -15804,6 +15842,24 @@ fail: } #endif +#ifndef NO__1gtk_1widget_1set_1visible +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1visible) + (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1set_1visible_FUNC); +/* + gtk_widget_set_visible(arg0, arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_set_visible) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jboolean))fp)(arg0, arg1); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1set_1visible_FUNC); +} +#endif + #ifndef NO__1gtk_1widget_1show JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1show) (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..e37a377ed8 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,9 @@ #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_set_can_focus_LIB LIB_GTK +#define gtk_widget_set_receives_default_LIB LIB_GTK +#define gtk_widget_set_visible_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 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..0cc21d9f8d 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 = 1318; +int OS_nativeFunctionCallCount[1318]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -1248,16 +1248,19 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1widget_1reparent", "_1gtk_1widget_1send_1expose", "_1gtk_1widget_1set_1app_1paintable", + "_1gtk_1widget_1set_1can_1focus", "_1gtk_1widget_1set_1default_1direction", "_1gtk_1widget_1set_1direction", "_1gtk_1widget_1set_1double_1buffered", "_1gtk_1widget_1set_1name", "_1gtk_1widget_1set_1parent_1window", + "_1gtk_1widget_1set_1receives_1default", "_1gtk_1widget_1set_1redraw_1on_1allocate", "_1gtk_1widget_1set_1sensitive", "_1gtk_1widget_1set_1size_1request", "_1gtk_1widget_1set_1state", "_1gtk_1widget_1set_1tooltip_1text", + "_1gtk_1widget_1set_1visible", "_1gtk_1widget_1show", "_1gtk_1widget_1size_1allocate", "_1gtk_1widget_1size_1request", 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..ef38018587 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 @@ -1256,16 +1256,19 @@ typedef enum { _1gtk_1widget_1reparent_FUNC, _1gtk_1widget_1send_1expose_FUNC, _1gtk_1widget_1set_1app_1paintable_FUNC, + _1gtk_1widget_1set_1can_1focus_FUNC, _1gtk_1widget_1set_1default_1direction_FUNC, _1gtk_1widget_1set_1direction_FUNC, _1gtk_1widget_1set_1double_1buffered_FUNC, _1gtk_1widget_1set_1name_FUNC, _1gtk_1widget_1set_1parent_1window_FUNC, + _1gtk_1widget_1set_1receives_1default_FUNC, _1gtk_1widget_1set_1redraw_1on_1allocate_FUNC, _1gtk_1widget_1set_1sensitive_FUNC, _1gtk_1widget_1set_1size_1request_FUNC, _1gtk_1widget_1set_1state_FUNC, _1gtk_1widget_1set_1tooltip_1text_FUNC, + _1gtk_1widget_1set_1visible_FUNC, _1gtk_1widget_1show_FUNC, _1gtk_1widget_1size_1allocate_FUNC, _1gtk_1widget_1size_1request_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..852789bb76 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 @@ -12374,6 +12374,36 @@ public static final void gtk_widget_set_direction(int /*long*/ widget, int dir) lock.unlock(); } } +/** @method flags=dynamic */ +public static final native void _gtk_widget_set_visible(int /*long*/ widget, boolean visible); +public static final void gtk_widget_set_visible(int /*long*/ widget, boolean visible) { + lock.lock(); + try { + _gtk_widget_set_visible(widget, visible); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native boolean _gtk_widget_set_can_focus(int /*long*/ widget, boolean can_focus); +public static final boolean gtk_widget_set_can_focus(int /*long*/ widget, boolean can_focus) { + lock.lock(); + try { + return _gtk_widget_set_can_focus(widget,can_focus); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native void _gtk_widget_set_receives_default(int /*long*/ widget, boolean receives_default); +public static final void gtk_widget_set_receives_default(int /*long*/ widget, boolean receives_default) { + lock.lock(); + try { + _gtk_widget_set_receives_default(widget, receives_default); + } finally { + lock.unlock(); + } +} /** * @param widget cast=(GtkWidget *) * @param double_buffered cast=(gboolean) 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 5adc42c51e..39a00b3b3a 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 @@ -420,7 +420,7 @@ void createHandle (int index) { * clear the GTK_RECEIVES_DEFAULT flag. */ if ((style & SWT.READ_ONLY) != 0 && buttonHandle != 0) { - OS.GTK_WIDGET_UNSET_FLAGS (buttonHandle, OS.GTK_RECEIVES_DEFAULT); + gtk_widget_set_receives_default (buttonHandle, false); } } 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 81445e9bd1..38a64a56b4 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 @@ -529,7 +529,7 @@ int /*long*/ focusHandle () { boolean forceFocus (int /*long*/ focusHandle) { if (socketHandle != 0) OS.GTK_WIDGET_SET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS); boolean result = super.forceFocus (focusHandle); - if (socketHandle != 0) OS.GTK_WIDGET_UNSET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS); + if (socketHandle != 0) gtk_widget_set_can_focus (focusHandle, false); return result; } 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 ed2c7673d2..457670d823 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 @@ -195,7 +195,7 @@ void fixFocus (Control focusControl) { OS.gtk_widget_grab_focus (focusHandle); // widget could be disposed at this point if (isDisposed ()) return; - OS.GTK_WIDGET_UNSET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (focusHandle, false); } void fixStyle () { @@ -823,7 +823,7 @@ void moveHandle (int x, int y) { * old bounds of the child are correctly redrawn. */ int flags = OS.GTK_WIDGET_FLAGS (parentHandle); - OS.GTK_WIDGET_UNSET_FLAGS (parentHandle, OS.GTK_VISIBLE); + gtk_widget_set_visible (parentHandle, false); OS.gtk_fixed_move (parentHandle, topHandle, x, y); if ((flags & OS.GTK_VISIBLE) != 0) { OS.GTK_WIDGET_SET_FLAGS (parentHandle, OS.GTK_VISIBLE); @@ -4467,7 +4467,7 @@ public void setVisible (boolean visible) { } state |= HIDDEN; if (fixFocus) { - OS.GTK_WIDGET_UNSET_FLAGS (topHandle, OS.GTK_VISIBLE); + gtk_widget_set_visible (topHandle, false); fixFocus (control); if (isDisposed ()) return; OS.GTK_WIDGET_SET_FLAGS (topHandle, OS.GTK_VISIBLE); 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 b83a946591..45f63ff97b 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 @@ -163,10 +163,10 @@ void createText(boolean dropDown) { createPopupShell(-1, -1, -1); } else { up = new Button(this, SWT.ARROW | SWT.UP); - OS.GTK_WIDGET_UNSET_FLAGS(up.handle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (up.handle, false); //up.setToolTipText(SWT.getMessage ("SWT_Up")); //$NON-NLS-1$ down = new Button(this, SWT.ARROW | SWT.DOWN); - OS.GTK_WIDGET_UNSET_FLAGS(down.handle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (down.handle, false); //down.setToolTipText(SWT.getMessage ("SWT_Down")); //$NON-NLS-1$ up.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { @@ -185,7 +185,7 @@ void createText(boolean dropDown) { void createDropDownButton() { down = new Button(this, SWT.ARROW | SWT.DOWN); - OS.GTK_WIDGET_UNSET_FLAGS(down.handle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (down.handle, false); down.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { boolean dropped = isDropped(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java index 5bd836678d..fce59bcd5f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java @@ -323,7 +323,7 @@ int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) { } int /*long*/ gtk_focus_out_event (int /*long*/ widget, int /*long*/ event) { - OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (handle, false); parent.lastFocus = this; return 0; } @@ -486,7 +486,7 @@ boolean setFocus () { // widget could be disposed at this point if (isDisposed ()) return false; boolean result = OS.gtk_widget_is_focus (handle); - if (!result) OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_CAN_FOCUS); + if (!result) gtk_widget_set_can_focus (handle, false); return result; } 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..2650e0d90c 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 @@ -949,7 +949,7 @@ public void setEnabled (boolean enabled) { if (enabled) { OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_SENSITIVE); } else { - OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_SENSITIVE); + OS.gtk_widget_set_sensitive (handle, false); } } 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..af3fd3c202 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 @@ -278,7 +278,7 @@ void createHandle (int index) { boolean 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); + if (!enabled) OS.gtk_widget_set_sensitive (parentHandle, false); OS.gtk_widget_show (handle); } 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 eb3bbcd8c5..3a90247443 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 @@ -1674,6 +1674,30 @@ int /*long*/ sizeRequestProc (int /*long*/ handle, int /*long*/ arg0, int /*long return 0; } +void gtk_widget_set_visible (int /*long*/ widget, boolean visible) { + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + OS.gtk_widget_set_visible (widget,visible); + } else { + OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_VISIBLE); + } +} + +void gtk_widget_set_can_focus (int /*long*/ widget, boolean can_focus) { + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + OS.gtk_widget_set_can_focus (widget, can_focus); + } else { + OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_CAN_FOCUS); + } +} + +void gtk_widget_set_receives_default (int /*long*/ widget, boolean receives_default) { + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + OS.gtk_widget_set_receives_default (widget, receives_default); + } else { + OS.GTK_WIDGET_UNSET_FLAGS (widget, OS.GTK_RECEIVES_DEFAULT); + } +} + /** * Returns a string containing a concise, human-readable * description of the receiver. |