From 5983c24ed5237e3fc3d1e8e4c23d3ce4ce153bac Mon Sep 17 00:00:00 2001 From: Anatoly Spektor Date: Thu, 2 Aug 2012 16:36:51 -0400 Subject: Omit use of deprecated GTK_WIDGET_FLAGS Conflicts: bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h --- .../Eclipse SWT PI/gtk/library/os.c | 80 ++++++++++++++++++++++ .../Eclipse SWT PI/gtk/library/os_custom.h | 9 +++ .../Eclipse SWT PI/gtk/library/os_stats.c | 8 ++- .../Eclipse SWT PI/gtk/library/os_stats.h | 4 ++ .../gtk/org/eclipse/swt/internal/gtk/OS.java | 40 +++++++++++ .../gtk/org/eclipse/swt/widgets/Button.java | 8 +-- .../gtk/org/eclipse/swt/widgets/Control.java | 14 ++-- .../gtk/org/eclipse/swt/widgets/Label.java | 2 +- .../gtk/org/eclipse/swt/widgets/ProgressBar.java | 2 +- .../gtk/org/eclipse/swt/widgets/Scrollable.java | 2 +- .../gtk/org/eclipse/swt/widgets/Shell.java | 2 +- .../gtk/org/eclipse/swt/widgets/TableItem.java | 2 +- .../gtk/org/eclipse/swt/widgets/TreeItem.java | 2 +- .../gtk/org/eclipse/swt/widgets/Widget.java | 32 +++++++++ 14 files changed, 188 insertions(+), 19 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 8185f816e0..266b466b85 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 @@ -15502,6 +15502,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1accessible) } #endif +#ifndef NO__1gtk_1widget_1get_1can_1default +JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1get_1can_1default) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1can_1default_FUNC); +/* + rc = (jboolean)gtk_widget_get_can_default(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_get_can_default) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1can_1default_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1widget_1get_1child_1visible JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1get_1child_1visible) (JNIEnv *env, jclass that, jintLong arg0) @@ -15538,6 +15558,26 @@ JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1widget_1get_1events) } #endif +#ifndef NO__1gtk_1widget_1get_1has_1window +JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1get_1has_1window) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1has_1window_FUNC); +/* + rc = (jboolean)gtk_widget_get_has_window(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_get_has_window) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1has_1window_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1widget_1get_1mapped JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1get_1mapped) (JNIEnv *env, jclass that, jintLong arg0) @@ -15606,6 +15646,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1parent_1window) } #endif +#ifndef NO__1gtk_1widget_1get_1realized +JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1get_1realized) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1realized_FUNC); +/* + rc = (jboolean)gtk_widget_get_realized(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_get_realized) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1realized_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1widget_1get_1sensitive JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1get_1sensitive) (JNIEnv *env, jclass that, jintLong arg0) @@ -15687,6 +15747,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1toplevel) } #endif +#ifndef NO__1gtk_1widget_1get_1visible +JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1get_1visible) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1visible_FUNC); +/* + rc = (jboolean)gtk_widget_get_visible(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_widget_get_visible) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1visible_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1widget_1grab_1focus JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1grab_1focus) (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 0a5fd5fe20..19f89145b3 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 @@ -206,6 +206,10 @@ #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 gtk_widget_get_has_window_LIB LIB_GTK +#define gtk_widget_get_visible_LIB LIB_GTK +#define gtk_widget_get_realized_LIB LIB_GTK +#define gtk_widget_get_can_default_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,11 +370,16 @@ #else #define GTK_SCROLLED_WINDOW_VSCROLLBAR(arg0) (arg0)->vscrollbar #endif +<<<<<<< HEAD #ifndef GTK_WIDGET_HAS_DEFAULT #define GTK_WIDGET_HAS_DEFAULT(arg0) 0 #endif #ifndef GTK_WIDGET_SENSITIVE #define GTK_WIDGET_SENSITIVE(arg0) 0 +======= +#ifndef GTK_OBJECT_FLAGS +#define GTK_OBJECT_FLAGS(arg0) 0 +>>>>>>> 4bf36e6... Omit use of deprecated GTK_WIDGET_FLAGS #endif #define GTK_WIDGET_HEIGHT(arg0) (arg0)->allocation.height #define GTK_WIDGET_SET_HEIGHT(arg0, arg1) (arg0)->allocation.height = arg1 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 746a2767fc..579ba0029a 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 = 1325; -int OS_nativeFunctionCallCount[1325]; +int OS_nativeFunctionCount = 1329; +int OS_nativeFunctionCallCount[1329]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -1227,19 +1227,23 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1widget_1destroy", "_1gtk_1widget_1event", "_1gtk_1widget_1get_1accessible", + "_1gtk_1widget_1get_1can_1default", "_1gtk_1widget_1get_1child_1visible", "_1gtk_1widget_1get_1default_1style", "_1gtk_1widget_1get_1events", + "_1gtk_1widget_1get_1has_1window", "_1gtk_1widget_1get_1mapped", "_1gtk_1widget_1get_1modifier_1style", "_1gtk_1widget_1get_1pango_1context", "_1gtk_1widget_1get_1parent", "_1gtk_1widget_1get_1parent_1window", + "_1gtk_1widget_1get_1realized", "_1gtk_1widget_1get_1sensitive", "_1gtk_1widget_1get_1size_1request", "_1gtk_1widget_1get_1style", "_1gtk_1widget_1get_1tooltip_1text", "_1gtk_1widget_1get_1toplevel", + "_1gtk_1widget_1get_1visible", "_1gtk_1widget_1grab_1focus", "_1gtk_1widget_1has_1default", "_1gtk_1widget_1hide", 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 036e9d8d3a..b0e3596a81 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 @@ -1235,19 +1235,23 @@ typedef enum { _1gtk_1widget_1destroy_FUNC, _1gtk_1widget_1event_FUNC, _1gtk_1widget_1get_1accessible_FUNC, + _1gtk_1widget_1get_1can_1default_FUNC, _1gtk_1widget_1get_1child_1visible_FUNC, _1gtk_1widget_1get_1default_1style_FUNC, _1gtk_1widget_1get_1events_FUNC, + _1gtk_1widget_1get_1has_1window_FUNC, _1gtk_1widget_1get_1mapped_FUNC, _1gtk_1widget_1get_1modifier_1style_FUNC, _1gtk_1widget_1get_1pango_1context_FUNC, _1gtk_1widget_1get_1parent_FUNC, _1gtk_1widget_1get_1parent_1window_FUNC, + _1gtk_1widget_1get_1realized_FUNC, _1gtk_1widget_1get_1sensitive_FUNC, _1gtk_1widget_1get_1size_1request_FUNC, _1gtk_1widget_1get_1style_FUNC, _1gtk_1widget_1get_1tooltip_1text_FUNC, _1gtk_1widget_1get_1toplevel_FUNC, + _1gtk_1widget_1get_1visible_FUNC, _1gtk_1widget_1grab_1focus_FUNC, _1gtk_1widget_1has_1default_FUNC, _1gtk_1widget_1hide_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 3357cf2ec5..1b09c73484 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 @@ -12150,6 +12150,46 @@ public static final int /*long*/ gtk_widget_get_accessible (int /*long*/ widget) lock.unlock(); } } +/** @method flags=dynamic */ +public static final native boolean _gtk_widget_get_visible (int /*long*/ widget); +public static final boolean gtk_widget_get_visible (int /*long*/ widget) { + lock.lock(); + try { + return _gtk_widget_get_visible(widget); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native boolean _gtk_widget_get_realized (int /*long*/ widget); +public static final boolean gtk_widget_get_realized (int /*long*/ widget) { + lock.lock(); + try { + return _gtk_widget_get_realized(widget); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native boolean _gtk_widget_get_has_window (int /*long*/ widget); +public static final boolean gtk_widget_get_has_window (int /*long*/ widget) { + lock.lock(); + try { + return _gtk_widget_get_has_window(widget); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native boolean _gtk_widget_get_can_default (int /*long*/ widget); +public static final boolean gtk_widget_get_can_default (int /*long*/ widget) { + lock.lock(); + try { + return _gtk_widget_get_can_default(widget); + } finally { + lock.unlock(); + } +} /** @param widget cast=(GtkWidget *) */ public static final native boolean _gtk_widget_get_child_visible (int /*long*/ widget); public static final boolean gtk_widget_get_child_visible (int /*long*/ widget) { 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 00a8b635b9..0be15510e2 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 @@ -184,7 +184,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { OS.gtk_widget_set_size_request (boxHandle, -1, -1); } Point size; - boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && (OS.GTK_WIDGET_FLAGS (labelHandle) & OS.GTK_VISIBLE) != 0; + boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && gtk_widget_get_visible (labelHandle); if (wrap) { int borderWidth = OS.gtk_container_get_border_width (handle); int[] focusWidth = new int[1]; @@ -207,7 +207,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { GtkBorder innerBorder = getBorder (OS.inner_border, handle, INNER_BORDER); trimWidth += innerBorder.left + innerBorder.right; trimHeight += innerBorder.top + innerBorder.bottom; - if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_CAN_DEFAULT) != 0) { + if (gtk_widget_get_can_default (handle)) { GtkBorder defaultBorder = getBorder (OS.default_border, handle, DEFAULT_BORDER); trimWidth += defaultBorder.left + defaultBorder.right; trimHeight += defaultBorder.top + defaultBorder.bottom; @@ -243,7 +243,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { OS.gtk_widget_set_size_request (boxHandle, reqWidth [0], reqHeight [0]); } if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) { - if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_CAN_DEFAULT) != 0) { + if (gtk_widget_get_can_default (handle)) { GtkBorder border = getBorder (OS.default_border, handle, DEFAULT_BORDER); if (wHint != SWT.DEFAULT) size.x += border.left + border.right; if (hHint != SWT.DEFAULT) size.y += border.top + border.bottom; @@ -737,7 +737,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize * resized to the preferred size but it still * won't draw properly. */ - boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && (OS.GTK_WIDGET_FLAGS (labelHandle) & OS.GTK_VISIBLE) != 0; + boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && gtk_widget_get_visible (labelHandle); if (wrap) OS.gtk_widget_set_size_request (boxHandle, -1, -1); int result = super.setBounds (x, y, width, height, move, resize); /* 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 7bdb801a71..7d512cb331 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 @@ -351,7 +351,7 @@ int /*long*/ paintHandle () { int /*long*/ topHandle = topHandle (); int /*long*/ paintHandle = handle; while (paintHandle != topHandle) { - if ((OS.GTK_WIDGET_FLAGS (paintHandle) & OS.GTK_NO_WINDOW) == 0) break; + if (gtk_widget_get_has_window (paintHandle)) break; paintHandle = OS.gtk_widget_get_parent (paintHandle); } return paintHandle; @@ -822,10 +822,10 @@ void moveHandle (int x, int y) { * NOTE: Because every widget in SWT has an X window, the new and * old bounds of the child are correctly redrawn. */ - int flags = OS.GTK_WIDGET_FLAGS (parentHandle); + boolean visible = gtk_widget_get_visible (parentHandle); OS.GTK_WIDGET_UNSET_FLAGS (parentHandle, OS.GTK_VISIBLE); OS.gtk_fixed_move (parentHandle, topHandle, x, y); - if ((flags & OS.GTK_VISIBLE) != 0) { + if (visible) { OS.GTK_WIDGET_SET_FLAGS (parentHandle, OS.GTK_VISIBLE); } } @@ -2313,7 +2313,7 @@ int /*long*/ fixedMapProc (int /*long*/ widget) { } OS.g_list_free (widgetList); } - if ((OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_NO_WINDOW) == 0) { + if (gtk_widget_get_has_window (widget)) { OS.gdk_window_show_unraised (OS.GTK_WIDGET_WINDOW (widget)); } return 0; @@ -3500,7 +3500,7 @@ void redrawChildren () { } void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean all, boolean trim) { - if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return; + if (!gtk_widget_get_realized(handle)) return; int /*long*/ window = paintWindow (); GdkRectangle rect = new GdkRectangle (); if (redrawAll) { @@ -4328,7 +4328,7 @@ public void setRedraw (boolean redraw) { } } else { if (drawCount++ == 0) { - if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) != 0) { + if (gtk_widget_get_realized (handle)) { int /*long*/ window = paintWindow (); Rectangle rect = getBounds (); GdkWindowAttr attributes = new GdkWindowAttr (); @@ -5078,7 +5078,7 @@ public void update () { void update (boolean all, boolean flush) { // checkWidget(); if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return; - if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return; + if (!gtk_widget_get_realized (handle)) return; int /*long*/ window = paintWindow (); if (flush) display.flushExposes (window, all); OS.gdk_window_process_updates (window, all); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java index 7f38f41c50..1d11b629e9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java @@ -129,7 +129,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { * The fix is to use pango layout directly instead of the label size request * to calculate its preferred size. */ - boolean fixWrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && (OS.GTK_WIDGET_FLAGS (labelHandle) & OS.GTK_VISIBLE) != 0; + boolean fixWrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && gtk_widget_get_visible (labelHandle); if (fixWrap || frameHandle != 0) forceResize (); if (fixWrap) { int /*long*/ labelLayout = OS.gtk_label_get_layout (labelHandle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java index ffae259736..30a87bcb95 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java @@ -287,7 +287,7 @@ void updateBar (int selection, int minimum, int maximum) { * fix is to update the progress bar state only when realized and restore * the state when the progress bar becomes realized. */ - if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return; + if (!gtk_widget_get_realized (handle)) return; double fraction = minimum == maximum ? 1 : (double)(selection - minimum) / (maximum - minimum); OS.gtk_progress_bar_set_fraction (handle, fraction); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java index 5f63d5d518..261114a3d7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java @@ -357,7 +357,7 @@ void redrawBackgroundImage () { void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean all, boolean trim) { super.redrawWidget (x, y, width, height, redrawAll, all, trim); - if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return; + if (!OS.gtk_widget_get_realized (handle)) return; if (!trim) return; int /*long*/ topHandle = topHandle (), paintHandle = paintHandle (); if (topHandle == paintHandle) return; 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 001b4cb64a..2fe47280e9 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 @@ -2490,7 +2490,7 @@ void setToolTipText (int /*long*/ rootWidget, int /*long*/ tipWidget, String str */ boolean set = true; if (tipWindow != 0) { - if ((OS.GTK_WIDGET_FLAGS (tipWidget) & (OS.GTK_REALIZED | OS.GTK_VISIBLE)) != 0) { + if (gtk_widget_get_visible (tipWidget) || gtk_widget_get_realized (tipWidget)) { int [] x = new int [1], y = new int [1]; int /*long*/ window = OS.gdk_window_at_pointer (x, y); if (window != 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java index 9042ad2475..a7fba59163 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java @@ -697,7 +697,7 @@ public Rectangle getTextBounds (int index) { } void redraw () { - if ((OS.GTK_WIDGET_FLAGS (parent.handle) & OS.GTK_REALIZED) != 0) { + if (gtk_widget_get_realized (parent.handle)) { int /*long*/ parentHandle = parent.handle; int /*long*/ path = OS.gtk_tree_model_get_path (parent.modelHandle, handle); GdkRectangle rect = new GdkRectangle (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java index 43277b1721..608876b4e9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java @@ -1052,7 +1052,7 @@ public int indexOf (TreeItem item) { void redraw () { int /*long*/ parentHandle = parent.handle; - if ((OS.GTK_WIDGET_FLAGS (parentHandle) & OS.GTK_REALIZED) != 0) { + if (gtk_widget_get_realized (parentHandle)) { int /*long*/ path = OS.gtk_tree_model_get_path (parent.modelHandle, handle); GdkRectangle rect = new GdkRectangle (); OS.gtk_tree_view_get_cell_area (parentHandle, path, 0, rect); 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 389c5fce7b..b9923e57f7 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 @@ -1698,6 +1698,38 @@ boolean gtk_widget_get_sensitive (int /*long*/ widget) { } } +boolean gtk_widget_get_visible (int /*long*/ widget) { + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + return OS.gtk_widget_get_visible (widget); + } else { + return (OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_VISIBLE) != 0; + } +} + +boolean gtk_widget_get_realized (int /*long*/ widget) { + if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { + return OS.gtk_widget_get_realized (widget); + } else { + return (OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_REALIZED) != 0; + } +} + +boolean gtk_widget_get_can_default (int /*long*/ widget){ + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + return OS.gtk_widget_get_can_default (widget); + } else { + return (OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_CAN_DEFAULT) != 0; + } +} + +boolean gtk_widget_get_has_window (int /*long*/ widget) { + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + return OS.gtk_widget_get_has_window (widget); + } else { + return (OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_NO_WINDOW) == 0; + } +} + /** * Returns a string containing a concise, human-readable * description of the receiver. -- cgit