diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-03 15:05:43 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-08-03 15:05:43 -0400 |
commit | 142c4a215162077cc41d4e3156c7ac7cef92aa8e (patch) | |
tree | 0b41b06a99c6f4b521b74fa6976d8454193e743b | |
parent | 4822314ab37f47dfb0b0f799d5608b1664eacde8 (diff) | |
download | eclipse.platform.swt-gtk_widget_get_visible.tar.gz eclipse.platform.swt-gtk_widget_get_visible.tar.xz eclipse.platform.swt-gtk_widget_get_visible.zip |
Use gtk_widget_get_visible instead of GTK_WIDGET_VISIBLE for newer GTKgtk_widget_get_visible
16 files changed, 80 insertions, 28 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java index 9c2821c9f5..217db1776c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java @@ -476,10 +476,18 @@ public class Accessible { int /*long*/ temp = list; while (temp != 0) { int /*long*/ widget = OS.g_list_data( temp); - if (OS.GTK_WIDGET_VISIBLE (widget)) { - result = widget; - break; + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + if (OS.gtk_widget_get_visible (widget)) { + result = widget; + break; + } + } else { + if (OS.GTK_WIDGET_VISIBLE (widget)) { + result = widget; + break; + } } + temp = OS.g_list_next (temp); } OS.g_list_free (list); 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..9a62a0a97b 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 @@ -15603,6 +15603,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 7656883294..28e8580512 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 @@ -200,6 +200,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_get_visible_LIB LIB_GTK #define gtk_widget_has_default_LIB LIB_GTK #define gtk_widget_set_tooltip_text_LIB LIB_GTK #define gtk_widget_set_has_window_LIB LIB_GTK @@ -366,6 +367,9 @@ #ifndef GTK_WIDGET_HAS_DEFAULT #define GTK_WIDGET_HAS_DEFAULT(arg0) 0 #endif +#ifndef GTK_WIDGET_VISIBLE +#define GTK_WIDGET_VISIBLE(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 4468de2f88..3f24faf134 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", @@ -1235,6 +1235,7 @@ char * OS_nativeFunctionNames[] = { "_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 da5dd954ae..bfb122a957 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 @@ -1243,6 +1243,7 @@ typedef enum { _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 b13bdeadd2..411d6cbc1b 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 @@ -12148,6 +12148,16 @@ public static final boolean gtk_widget_get_mapped(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(); + } +} /** @param widget cast=(GtkWidget *) */ public static final native int /*long*/ _gtk_widget_get_pango_context(int /*long*/ widget); public static final int /*long*/ gtk_widget_get_pango_context(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 2e1a82bf05..fb5160890a 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 @@ -214,7 +214,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { } } int imageWidth = 0, imageHeight = 0; - if (OS.GTK_WIDGET_VISIBLE (imageHandle)) { + if (gtk_widget_get_visible (imageHandle)) { GtkRequisition requisition = new GtkRequisition (); OS.gtk_widget_size_request (imageHandle, requisition); imageWidth = requisition.width; @@ -677,7 +677,7 @@ void _setAlignment (int alignment) { style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER); style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER); /* Alignment not honoured when image and text are visible */ - boolean bothVisible = OS.GTK_WIDGET_VISIBLE (labelHandle) && OS.GTK_WIDGET_VISIBLE (imageHandle); + boolean bothVisible = gtk_widget_get_visible (labelHandle) && gtk_widget_get_visible (imageHandle); if (bothVisible) { if ((style & (SWT.RADIO | SWT.CHECK)) != 0) alignment = SWT.LEFT; if ((style & (SWT.PUSH | SWT.TOGGLE)) != 0) alignment = SWT.CENTER; @@ -761,7 +761,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize OS.pango_layout_get_size (labelLayout, w, h); OS.pango_layout_set_width (labelLayout, pangoWidth); int imageWidth = 0; - if (OS.GTK_WIDGET_VISIBLE (imageHandle)) { + if (gtk_widget_get_visible (imageHandle)) { GtkRequisition requisition = new GtkRequisition (); OS.gtk_widget_size_request (imageHandle, requisition); imageWidth = requisition.width; 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 84c8c8fbf2..fcff42b2c1 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 @@ -872,7 +872,7 @@ public String [] getItems () { */ public boolean getListVisible () { checkWidget (); - return popupHandle != 0 && OS.GTK_WIDGET_VISIBLE (popupHandle); + return popupHandle != 0 && gtk_widget_get_visible (popupHandle); } String getNameText () { 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..de434359d6 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 @@ -2306,7 +2306,7 @@ int /*long*/ fixedMapProc (int /*long*/ widget) { int /*long*/ widgets = widgetList; while (widgets != 0) { int /*long*/ child = OS.g_list_data (widgets); - if (OS.GTK_WIDGET_VISIBLE (child) && OS.gtk_widget_get_child_visible (child) && !gtk_widget_get_mapped (child)) { + if (gtk_widget_get_visible (child) && OS.gtk_widget_get_child_visible (child) && !gtk_widget_get_mapped (child)) { OS.gtk_widget_map (child); } widgets = OS.g_list_next (widgets); @@ -3455,7 +3455,7 @@ public void redraw () { void redraw (boolean all) { // checkWidget(); - if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return; + if (!gtk_widget_get_visible (topHandle ())) return; redrawWidget (0, 0, 0, 0, true, all, false); } @@ -3491,7 +3491,7 @@ void redraw (boolean all) { */ public void redraw (int x, int y, int width, int height, boolean all) { checkWidget(); - if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return; + if (!gtk_widget_get_visible (topHandle ())) return; if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - width - x; redrawWidget (x, y, width, height, false, all, false); } @@ -3992,7 +3992,7 @@ public void setEnabled (boolean enabled) { } else { restackWindow (enableWindow, OS.GTK_WIDGET_WINDOW (topHandle), true); } - if (OS.GTK_WIDGET_VISIBLE (topHandle)) OS.gdk_window_show_unraised (enableWindow); + if (gtk_widget_get_visible (topHandle)) OS.gdk_window_show_unraised (enableWindow); } } if (fixFocus) fixFocus (control); @@ -5077,7 +5077,7 @@ public void update () { void update (boolean all, boolean flush) { // checkWidget(); - if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return; + if (!gtk_widget_get_visible (topHandle ())) return; if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return; int /*long*/ window = paintWindow (); if (flush) display.flushExposes (window, all); 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..30b793dac8 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 @@ -401,7 +401,7 @@ void resizeControl (int yScroll) { */ ScrollBar vBar = parent.verticalBar; if (vBar != null) { - if (OS.GTK_WIDGET_VISIBLE (vBar.handle)) { + if (gtk_widget_get_visible (vBar.handle)) { width = OS.GTK_WIDGET_WIDTH (parent.scrolledHandle) - parent.vScrollBarWidth () - 2 * parent.spacing; } } 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..c57fdb6de5 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 @@ -450,9 +450,9 @@ public boolean getVisible () { int [] hsp = new int [1], vsp = new int [1]; OS.gtk_scrolled_window_get_policy (scrolledHandle, hsp, vsp); if ((style & SWT.HORIZONTAL) != 0) { - return hsp [0] != OS.GTK_POLICY_NEVER && OS.GTK_WIDGET_VISIBLE(handle); + return hsp [0] != OS.GTK_POLICY_NEVER && gtk_widget_get_visible (handle); } else { - return vsp [0] != OS.GTK_POLICY_NEVER && OS.GTK_WIDGET_VISIBLE(handle); + return vsp [0] != OS.GTK_POLICY_NEVER && gtk_widget_get_visible (handle); } } 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..78588a9b8b 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 @@ -283,7 +283,7 @@ int /*long*/ gtk_scroll_event (int /*long*/ widget, int /*long*/ eventPtr) { } else { scrollBar = horizontalBar; } - if (scrollBar != null && !OS.GTK_WIDGET_VISIBLE (scrollBar.handle) && scrollBar.getEnabled()) { + if (scrollBar != null && !gtk_widget_get_visible (scrollBar.handle) && scrollBar.getEnabled()) { GtkAdjustment adjustment = new GtkAdjustment (); OS.memmove (adjustment, scrollBar.adjustmentHandle); /* Calculate wheel delta to match GTK+ 2.4 and higher */ 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 2a62e480cc..d24a5e13ac 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 @@ -501,7 +501,7 @@ void adjustTrim () { } void bringToTop (boolean force) { - if (!OS.GTK_WIDGET_VISIBLE (shellHandle)) return; + if (!gtk_widget_get_visible (shellHandle)) return; Display display = this.display; Shell activeShell = display.activeShell; if (activeShell == this) return; @@ -1066,7 +1066,7 @@ public Point getSize () { public boolean getVisible () { checkWidget(); - return OS.GTK_WIDGET_VISIBLE (shellHandle); + return gtk_widget_get_visible (shellHandle); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java index c7da6c4393..562089f4db 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java @@ -459,9 +459,9 @@ public String getText () { */ public boolean getVisible () { checkWidget (); - if ((style & SWT.BALLOON) != 0) return OS.GTK_WIDGET_VISIBLE (handle); + if ((style & SWT.BALLOON) != 0) return gtk_widget_get_visible (handle); int /*long*/ tipWindow = OS.GTK_TOOLTIPS_TIP_WINDOW (handle); - return OS.GTK_WIDGET_VISIBLE (tipWindow); + return gtk_widget_get_visible (tipWindow); } int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) { @@ -713,10 +713,10 @@ public void setLocation (int x, int y) { this.x = x; this.y = y; if ((style & SWT.BALLOON) != 0) { - if (OS.GTK_WIDGET_VISIBLE (handle)) configure (); + if (gtk_widget_get_visible (handle)) configure (); } else { int /*long*/ tipWindow = OS.GTK_TOOLTIPS_TIP_WINDOW (handle); - if (OS.GTK_WIDGET_VISIBLE (tipWindow)) { + if (gtk_widget_get_visible (tipWindow)) { OS.gtk_window_move (tipWindow, x, y); } } @@ -778,7 +778,7 @@ public void setMessage (String string) { } OS.pango_layout_set_wrap (layoutMessage, OS.PANGO_WRAP_WORD_CHAR); } - if (OS.GTK_WIDGET_VISIBLE (handle)) configure (); + if (gtk_widget_get_visible (handle)) configure (); } /** @@ -819,7 +819,7 @@ public void setText (String string) { OS.pango_attr_list_unref (attrList); OS.pango_layout_set_wrap (layoutText, OS.PANGO_WRAP_WORD_CHAR); } - if (OS.GTK_WIDGET_VISIBLE (handle)) configure (); + if (gtk_widget_get_visible (handle)) configure (); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java index 2a82fb8e45..2838dd37a5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java @@ -388,7 +388,7 @@ public boolean getVisible () { if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { return OS.gtk_status_icon_get_visible (handle); } - return OS.GTK_WIDGET_VISIBLE (handle); + return gtk_widget_get_visible (handle); } void register () { @@ -615,7 +615,7 @@ public void setVisible (boolean visible) { if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { if(OS.gtk_status_icon_get_visible (handle) == visible) return; } else { - if (OS.GTK_WIDGET_VISIBLE (handle) == visible) return; + if (gtk_widget_get_visible (handle) == visible) return; } if (visible) { /* 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..c791d839c7 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 @@ -906,6 +906,14 @@ boolean gtk_widget_get_mapped (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_VISIBLE (widget); + } +} + int /*long*/ gtk_window_state_event (int /*long*/ widget, int /*long*/ event) { return 0; } |