From 31b7a613958123368d896ee9b0a636412f2a598b Mon Sep 17 00:00:00 2001 From: Anatoly Spektor Date: Fri, 3 Aug 2012 10:07:07 -0400 Subject: Bug 386145 Use gtk_widget_get_window() instead of GTK_WIDGET_WINDOW in newer GTK+ --- .../gtk/org/eclipse/swt/awt/SWT_AWT.java | 7 +- .../swt/accessibility/AccessibleObject.java | 7 +- .../gtk/org/eclipse/swt/dnd/DropTarget.java | 8 +- .../gtk/org/eclipse/swt/opengl/GLCanvas.java | 21 +- .../Eclipse SWT PI/gtk/library/os.c | 373 ++------------------- .../Eclipse SWT PI/gtk/library/os_custom.h | 5 + .../Eclipse SWT PI/gtk/library/os_stats.c | 5 +- .../Eclipse SWT PI/gtk/library/os_stats.h | 1 + .../gtk/org/eclipse/swt/internal/gtk/OS.java | 10 + .../gtk/org/eclipse/swt/widgets/Combo.java | 2 +- .../gtk/org/eclipse/swt/widgets/Composite.java | 6 +- .../gtk/org/eclipse/swt/widgets/Control.java | 24 +- .../gtk/org/eclipse/swt/widgets/Display.java | 14 +- .../gtk/org/eclipse/swt/widgets/Menu.java | 2 +- .../gtk/org/eclipse/swt/widgets/Sash.java | 6 +- .../gtk/org/eclipse/swt/widgets/ScrollBar.java | 8 +- .../gtk/org/eclipse/swt/widgets/Scrollable.java | 2 +- .../gtk/org/eclipse/swt/widgets/Shell.java | 29 +- .../gtk/org/eclipse/swt/widgets/Table.java | 4 +- .../gtk/org/eclipse/swt/widgets/ToolTip.java | 10 +- .../gtk/org/eclipse/swt/widgets/Tracker.java | 4 +- .../gtk/org/eclipse/swt/widgets/TrayItem.java | 2 +- .../gtk/org/eclipse/swt/widgets/Tree.java | 4 +- .../gtk/org/eclipse/swt/widgets/Widget.java | 8 + 24 files changed, 149 insertions(+), 413 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java index 998cfa0685..5aec4a5379 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java @@ -202,7 +202,12 @@ public static Frame new_Frame (final Composite parent) { loadLibrary(); int /*long*/ awtHandle = getAWTHandle(window); if (awtHandle == 0) return; - int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid(OS.GTK_WIDGET_WINDOW(OS.gtk_widget_get_toplevel(shell.handle))); + int /*long*/ xWindow; + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + xWindow = OS.gdk_x11_drawable_get_xid(OS.gtk_widget_get_window(OS.gtk_widget_get_toplevel(shell.handle))); + } else { + xWindow = OS.gdk_x11_drawable_get_xid(OS.GTK_WIDGET_WINDOW(OS.gtk_widget_get_toplevel(shell.handle))); + } OS.XSetTransientForHint(OS.gdk_x11_display_get_xdisplay(OS.gdk_display_get_default()), awtHandle, xWindow); } }); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java index 92c38a3f7d..0499c3ea4e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java @@ -3462,7 +3462,12 @@ class AccessibleObject { } if (gtkAccessible.widget == 0) return; int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); + int /*long*/ window; + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + window = OS.gtk_widget_get_window (topLevel); + } else { + window = OS.GTK_WIDGET_WINDOW (topLevel); + } OS.gdk_window_get_origin (window, x, y); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java index c9cc25ade2..eeb43d3019 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java @@ -771,8 +771,12 @@ boolean setEventData(int /*long*/ context, int x, int y, int time, DNDEvent even } } if (dataTypes.length == 0) return false; - - int /*long*/ window = OS.GTK_WIDGET_WINDOW(control.handle); + int /*long*/ window; + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + window = OS.gtk_widget_get_window (control.handle); + } else { + window = OS.GTK_WIDGET_WINDOW(control.handle); + } int [] origin_x = new int[1], origin_y = new int[1]; OS.gdk_window_get_origin(window, origin_x, origin_y); Point coordinates = new Point(origin_x[0] + x, origin_y[0] + y); diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java index af4b7a671f..4686202e84 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java @@ -104,7 +104,12 @@ public GLCanvas (Composite parent, int style, GLData data) { } glxAttrib [pos++] = 0; OS.gtk_widget_realize (handle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window; + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + window = OS.gtk_widget_get_window (handle); + } else { + window = OS.GTK_WIDGET_WINDOW (handle); + } int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); int /*long*/ infoPtr = GLX.glXChooseVisual (xDisplay, OS.XDefaultScreen (xDisplay), glxAttrib); if (infoPtr == 0) { @@ -156,7 +161,12 @@ public GLCanvas (Composite parent, int style, GLData data) { OS.gdk_window_resize (glWindow, clientArea.width, clientArea.height); break; case SWT.Dispose: - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window; + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + window = OS.gtk_widget_get_window (handle); + } else { + window = OS.GTK_WIDGET_WINDOW (handle); + } int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); if (context != 0) { if (GLX.glXGetCurrentContext () == context) { @@ -189,7 +199,12 @@ public GLCanvas (Composite parent, int style, GLData data) { */ public GLData getGLData () { checkWidget (); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window; + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + window = OS.gtk_widget_get_window (handle); + } else { + window = OS.GTK_WIDGET_WINDOW (handle); + } int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); GLData data = new GLData (); int [] value = new int [1]; 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 eec327c6e8..cf8c805411 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 @@ -1683,6 +1683,18 @@ JNIEXPORT void JNICALL OS_NATIVE(_1GTK_1WIDGET_1SET_1FLAGS) } #endif +#ifndef NO__1GTK_1WIDGET_1STATE +JNIEXPORT jint JNICALL OS_NATIVE(_1GTK_1WIDGET_1STATE) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1GTK_1WIDGET_1STATE_FUNC); + rc = (jint)GTK_WIDGET_STATE(arg0); + OS_NATIVE_EXIT(env, that, _1GTK_1WIDGET_1STATE_FUNC); + return rc; +} +#endif + #ifndef NO__1GTK_1WIDGET_1UNSET_1FLAGS JNIEXPORT void JNICALL OS_NATIVE(_1GTK_1WIDGET_1UNSET_1FLAGS) (JNIEnv *env, jclass that, jintLong arg0, jint arg1) @@ -3580,26 +3592,6 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1object_1ref) } #endif -#ifndef NO__1g_1object_1ref_1sink -JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1object_1ref_1sink) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jintLong rc = 0; - OS_NATIVE_ENTER(env, that, _1g_1object_1ref_1sink_FUNC); -/* - rc = (jintLong)g_object_ref_sink(arg0); -*/ - { - OS_LOAD_FUNCTION(fp, g_object_ref_sink) - if (fp) { - rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); - } - } - OS_NATIVE_EXIT(env, that, _1g_1object_1ref_1sink_FUNC); - return rc; -} -#endif - #if (!defined(NO__1g_1object_1set__I_3BFI) && !defined(JNI64)) || (!defined(NO__1g_1object_1set__J_3BFJ) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1set__I_3BFI)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jfloat arg2, jintLong arg3) @@ -6094,47 +6086,6 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1pixbuf_1scale_1simple) } #endif -#ifndef NO__1gdk_1pixmap_1get_1size -JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1pixmap_1get_1size) - (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2) -{ - jint *lparg1=NULL; - jint *lparg2=NULL; - OS_NATIVE_ENTER(env, that, _1gdk_1pixmap_1get_1size_FUNC); -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { - if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = (*env)->GetPrimitiveArrayCritical(env, arg2, NULL)) == NULL) goto fail; - } else -#endif - { - if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - } -/* - gdk_pixmap_get_size((GdkPixmap *)arg0, (gint *)lparg1, (gint *)lparg2); -*/ - { - OS_LOAD_FUNCTION(fp, gdk_pixmap_get_size) - if (fp) { - ((void (CALLING_CONVENTION*)(GdkPixmap *, gint *, gint *))fp)((GdkPixmap *)arg0, (gint *)lparg1, (gint *)lparg2); - } - } -fail: -#ifdef JNI_VERSION_1_2 - if (IS_JNI_1_2) { - if (arg2 && lparg2) (*env)->ReleasePrimitiveArrayCritical(env, arg2, lparg2, 0); - if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, 0); - } else -#endif - { - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); - } - OS_NATIVE_EXIT(env, that, _1gdk_1pixmap_1get_1size_FUNC); -} -#endif - #ifndef NO__1gdk_1pixmap_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1pixmap_1new) (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jint arg2, jint arg3) @@ -6756,26 +6707,6 @@ fail: } #endif -#ifndef NO__1gdk_1window_1get_1height -JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1window_1get_1height) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, _1gdk_1window_1get_1height_FUNC); -/* - rc = (jint)gdk_window_get_height((GdkWindow *)arg0); -*/ - { - OS_LOAD_FUNCTION(fp, gdk_window_get_height) - if (fp) { - rc = (jint)((jint (CALLING_CONVENTION*)(GdkWindow *))fp)((GdkWindow *)arg0); - } - } - OS_NATIVE_EXIT(env, that, _1gdk_1window_1get_1height_FUNC); - return rc; -} -#endif - #ifndef NO__1gdk_1window_1get_1internal_1paint_1info JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1window_1get_1internal_1paint_1info) (JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1, jintArray arg2, jintArray arg3) @@ -6880,26 +6811,6 @@ fail: } #endif -#ifndef NO__1gdk_1window_1get_1width -JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1window_1get_1width) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, _1gdk_1window_1get_1width_FUNC); -/* - rc = (jint)gdk_window_get_width((GdkWindow *)arg0); -*/ - { - OS_LOAD_FUNCTION(fp, gdk_window_get_width) - if (fp) { - rc = (jint)((jint (CALLING_CONVENTION*)(GdkWindow *))fp)((GdkWindow *)arg0); - } - } - OS_NATIVE_EXIT(env, that, _1gdk_1window_1get_1width_FUNC); - return rc; -} -#endif - #ifndef NO__1gdk_1window_1hide JNIEXPORT void JNICALL OS_NATIVE(_1gdk_1window_1hide) (JNIEnv *env, jclass that, jintLong arg0) @@ -7298,42 +7209,6 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1window_1lookup_1for_1display) } #endif -#ifndef NO__1glib_1major_1version -JNIEXPORT jint JNICALL OS_NATIVE(_1glib_1major_1version) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, _1glib_1major_1version_FUNC); - rc = (jint)glib_major_version; - OS_NATIVE_EXIT(env, that, _1glib_1major_1version_FUNC); - return rc; -} -#endif - -#ifndef NO__1glib_1micro_1version -JNIEXPORT jint JNICALL OS_NATIVE(_1glib_1micro_1version) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, _1glib_1micro_1version_FUNC); - rc = (jint)glib_micro_version; - OS_NATIVE_EXIT(env, that, _1glib_1micro_1version_FUNC); - return rc; -} -#endif - -#ifndef NO__1glib_1minor_1version -JNIEXPORT jint JNICALL OS_NATIVE(_1glib_1minor_1version) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, _1glib_1minor_1version_FUNC); - rc = (jint)glib_minor_version; - OS_NATIVE_EXIT(env, that, _1glib_1minor_1version_FUNC); - return rc; -} -#endif - #ifndef NO__1gtk_1accel_1group_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1accel_1group_1new) (JNIEnv *env, jclass that) @@ -9282,15 +9157,7 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1fixed_1set_1has_1window) (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1) { OS_NATIVE_ENTER(env, that, _1gtk_1fixed_1set_1has_1window_FUNC); -/* - gtk_fixed_set_has_window(arg0, arg1); -*/ - { - OS_LOAD_FUNCTION(fp, gtk_fixed_set_has_window) - if (fp) { - ((void (CALLING_CONVENTION*)(jintLong, jboolean))fp)(arg0, arg1); - } - } + gtk_fixed_set_has_window((GtkFixed *)arg0, (gboolean)arg1); OS_NATIVE_EXIT(env, that, _1gtk_1fixed_1set_1has_1window_FUNC); } #endif @@ -10520,15 +10387,7 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1object_1sink) (JNIEnv *env, jclass that, jintLong arg0) { OS_NATIVE_ENTER(env, that, _1gtk_1object_1sink_FUNC); -/* - gtk_object_sink(arg0); -*/ - { - OS_LOAD_FUNCTION(fp, gtk_object_sink) - if (fp) { - ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0); - } - } + gtk_object_sink((GtkObject *)arg0); OS_NATIVE_EXIT(env, that, _1gtk_1object_1sink_FUNC); } #endif @@ -13973,15 +13832,7 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1tooltips_1new) { jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gtk_1tooltips_1new_FUNC); -/* rc = (jintLong)gtk_tooltips_new(); -*/ - { - OS_LOAD_FUNCTION(fp, gtk_tooltips_new) - if (fp) { - rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)(); - } - } OS_NATIVE_EXIT(env, that, _1gtk_1tooltips_1new_FUNC); return rc; } @@ -15510,48 +15361,6 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1accessible) } #endif -#ifndef NO__1gtk_1widget_1get_1allocation -JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1get_1allocation) - (JNIEnv *env, jclass that, jintLong arg0, jobject arg1) -{ - GtkAllocation _arg1, *lparg1=NULL; - OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1allocation_FUNC); - if (arg1) if ((lparg1 = &_arg1) == NULL) goto fail; -/* - gtk_widget_get_allocation((GtkWidget *)arg0, (GtkAllocation *)lparg1); -*/ - { - OS_LOAD_FUNCTION(fp, gtk_widget_get_allocation) - if (fp) { - ((void (CALLING_CONVENTION*)(GtkWidget *, GtkAllocation *))fp)((GtkWidget *)arg0, (GtkAllocation *)lparg1); - } - } -fail: - if (arg1 && lparg1) setGtkAllocationFields(env, arg1, lparg1); - OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1allocation_FUNC); -} -#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) @@ -15588,46 +15397,6 @@ 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) -{ - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1mapped_FUNC); -/* - rc = (jboolean)gtk_widget_get_mapped(arg0); -*/ - { - OS_LOAD_FUNCTION(fp, gtk_widget_get_mapped) - if (fp) { - rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); - } - } - OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1mapped_FUNC); - return rc; -} -#endif - #ifndef NO__1gtk_1widget_1get_1modifier_1style JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1modifier_1style) (JNIEnv *env, jclass that, jintLong arg0) @@ -15676,46 +15445,6 @@ 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) -{ - 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) @@ -15777,22 +15506,22 @@ 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) +#ifndef NO__1gtk_1widget_1get_1window +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1window) (JNIEnv *env, jclass that, jintLong arg0) { - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1visible_FUNC); + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1window_FUNC); /* - rc = (jboolean)gtk_widget_get_visible(arg0); + rc = (jintLong)gtk_widget_get_window(arg0); */ { - OS_LOAD_FUNCTION(fp, gtk_widget_get_visible) + OS_LOAD_FUNCTION(fp, gtk_widget_get_window) if (fp) { - rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); } } - OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1visible_FUNC); + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1window_FUNC); return rc; } #endif @@ -15807,46 +15536,6 @@ 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_1has_1focus -JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1has_1focus) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jboolean rc = 0; - OS_NATIVE_ENTER(env, that, _1gtk_1widget_1has_1focus_FUNC); -/* - rc = (jboolean)gtk_widget_has_focus(arg0); -*/ - { - OS_LOAD_FUNCTION(fp, gtk_widget_has_focus) - if (fp) { - rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); - } - } - OS_NATIVE_EXIT(env, that, _1gtk_1widget_1has_1focus_FUNC); - return rc; -} -#endif - #ifndef NO__1gtk_1widget_1hide JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1hide) (JNIEnv *env, jclass that, jintLong arg0) @@ -16049,24 +15738,6 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1double_1buffered) } #endif -#ifndef NO__1gtk_1widget_1set_1has_1window -JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1has_1window) - (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1) -{ - OS_NATIVE_ENTER(env, that, _1gtk_1widget_1set_1has_1window_FUNC); -/* - gtk_widget_set_has_window(arg0, arg1); -*/ - { - OS_LOAD_FUNCTION(fp, gtk_widget_set_has_window) - if (fp) { - ((void (CALLING_CONVENTION*)(jintLong, jboolean))fp)(arg0, arg1); - } - } - OS_NATIVE_EXIT(env, that, _1gtk_1widget_1set_1has_1window_FUNC); -} -#endif - #ifndef NO__1gtk_1widget_1set_1name JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1name) (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) 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 5e1316d614..2b5ccc4bc4 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 @@ -217,6 +217,7 @@ #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 gtk_widget_get_window_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 @@ -413,7 +414,11 @@ #define GTK_WIDGET_WIDTH(arg0) (arg0)->allocation.width #endif #define GTK_WIDGET_SET_WIDTH(arg0, arg1) (arg0)->allocation.width = arg1 +#if GTK_CHECK_VERSION(2,14,0) +#define GTK_WIDGET_WINDOW(arg0) 0 +#else #define GTK_WIDGET_WINDOW(arg0) (arg0)->window +#endif #if GTK_CHECK_VERSION(2,18,0) #define GTK_WIDGET_X(arg0) 0 #else 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 12a1623875..4e33f737a5 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 = 1331; -int OS_nativeFunctionCallCount[1331]; +int OS_nativeFunctionCount = 1332; +int OS_nativeFunctionCallCount[1332]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -1245,6 +1245,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1widget_1get_1tooltip_1text", "_1gtk_1widget_1get_1toplevel", "_1gtk_1widget_1get_1visible", + "_1gtk_1widget_1get_1window", "_1gtk_1widget_1grab_1focus", "_1gtk_1widget_1has_1default", "_1gtk_1widget_1has_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 bd9f5ce063..d3c68639e1 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 @@ -1253,6 +1253,7 @@ typedef enum { _1gtk_1widget_1get_1tooltip_1text_FUNC, _1gtk_1widget_1get_1toplevel_FUNC, _1gtk_1widget_1get_1visible_FUNC, + _1gtk_1widget_1get_1window_FUNC, _1gtk_1widget_1grab_1focus_FUNC, _1gtk_1widget_1has_1default_FUNC, _1gtk_1widget_1has_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 f2dbe0a18d..0b86c3d3d5 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 @@ -12220,6 +12220,16 @@ public static final int gtk_widget_get_events(int /*long*/ widget) { lock.unlock(); } } +/** @method flags=dynamic */ +public static final native int /*long*/ _gtk_widget_get_window (int /*long*/ widget); +public static final int /*long*/ gtk_widget_get_window (int /*long*/ widget) { + lock.lock(); + try { + return _gtk_widget_get_window(widget); + } finally { + lock.unlock(); + } +} /** @param widget cast=(GtkWidget *) */ public static final native int /*long*/ _gtk_widget_get_modifier_style(int /*long*/ widget); public static final int /*long*/ gtk_widget_get_modifier_style(int /*long*/ widget) { 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 c8cf6b11d7..db7c8c5518 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 @@ -1441,7 +1441,7 @@ boolean isFocusHandle(int widget) { int /*long*/ paintWindow () { int /*long*/ childHandle = entryHandle != 0 ? entryHandle : handle; OS.gtk_widget_realize (childHandle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (childHandle); + int /*long*/ window = gtk_widget_get_window (childHandle); if ((style & SWT.READ_ONLY) != 0) return window; int /*long*/ children = OS.gdk_window_get_children (window); if (children != 0) window = OS.g_list_data (children); 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 2f3366309d..84c8a8e26e 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 @@ -504,7 +504,7 @@ void fixTabList (Control control) { void fixZOrder () { if ((state & CANVAS) != 0) return; int /*long*/ parentHandle = parentingHandle (); - int /*long*/ parentWindow = OS.GTK_WIDGET_WINDOW (parentHandle); + int /*long*/ parentWindow = gtk_widget_get_window (parentHandle); if (parentWindow == 0) return; int /*long*/ [] userData = new int /*long*/ [1]; int /*long*/ windowList = OS.gdk_window_get_children (parentWindow); @@ -797,7 +797,7 @@ int /*long*/ gtk_map (int /*long*/ widget) { int /*long*/ gtk_realize (int /*long*/ widget) { int /*long*/ result = super.gtk_realize (widget); if ((style & SWT.NO_BACKGROUND) != 0) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ()); + int /*long*/ window = gtk_widget_get_window (paintHandle ()); if (window != 0) OS.gdk_window_set_back_pixmap (window, 0, false); } if (socketHandle != 0) { @@ -815,7 +815,7 @@ int /*long*/ gtk_scroll_child (int /*long*/ widget, int /*long*/ scrollType, int int /*long*/ gtk_style_set (int /*long*/ widget, int /*long*/ previousStyle) { int /*long*/ result = super.gtk_style_set (widget, previousStyle); if ((style & SWT.NO_BACKGROUND) != 0) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ()); + int /*long*/ window = gtk_widget_get_window (paintHandle ()); if (window != 0) OS.gdk_window_set_back_pixmap (window, 0, 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 2fdee0e79a..27e8a5be3f 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 @@ -157,7 +157,7 @@ void drawBackground (Control control, int /*long*/ window, int /*long*/ region, boolean drawGripper (int x, int y, int width, int height, boolean vertical) { int /*long*/ paintHandle = paintHandle (); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle); + int /*long*/ window = gtk_widget_get_window (paintHandle); if (window == 0) return false; int orientation = vertical ? OS.GTK_ORIENTATION_HORIZONTAL : OS.GTK_ORIENTATION_VERTICAL; if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - width - x; @@ -180,7 +180,7 @@ int /*long*/ eventHandle () { int /*long*/ eventWindow () { int /*long*/ eventHandle = eventHandle (); OS.gtk_widget_realize (eventHandle); - return OS.GTK_WIDGET_WINDOW (eventHandle); + return gtk_widget_get_window (eventHandle); } void fixFocus (Control focusControl) { @@ -360,7 +360,7 @@ int /*long*/ paintHandle () { int /*long*/ paintWindow () { int /*long*/ paintHandle = paintHandle (); OS.gtk_widget_realize (paintHandle); - return OS.GTK_WIDGET_WINDOW (paintHandle); + return gtk_widget_get_window (paintHandle); } /** @@ -386,7 +386,7 @@ public boolean print (GC gc) { if (gc.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); int /*long*/ topHandle = topHandle (); OS.gtk_widget_realize (topHandle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle); + int /*long*/ window = gtk_widget_get_window (topHandle); GCData data = gc.getGCData (); OS.gdk_window_process_updates (window, true); int /*long*/ drawable = data.drawable; @@ -399,7 +399,7 @@ void printWidget (GC gc, int /*long*/ drawable, int depth, int x, int y) { boolean obscured = (state & OBSCURED) != 0; state &= ~OBSCURED; int /*long*/ topHandle = topHandle (); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle); + int /*long*/ window = gtk_widget_get_window (topHandle); printWindow (true, this, gc, drawable, depth, window, x, y); if (obscured) state |= OBSCURED; } @@ -825,7 +825,7 @@ void modifyStyle (int /*long*/ handle, int /*long*/ style) { * has had a region set on it, the region is lost. The * fix is to set the region again. */ - if (region != null) OS.gdk_window_shape_combine_region (OS.GTK_WIDGET_WINDOW (topHandle ()), region.handle, 0, 0); + if (region != null) OS.gdk_window_shape_combine_region (gtk_widget_get_window (topHandle ()), region.handle, 0, 0); } void moveHandle (int x, int y) { @@ -1144,7 +1144,7 @@ public void setSize (Point size) { public void setRegion (Region region) { checkWidget (); if (region != null && region.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle ()); + int /*long*/ window = gtk_widget_get_window (topHandle ()); int /*long*/ shape_region = (region == null) ? 0 : region.handle; OS.gdk_window_shape_combine_region (window, shape_region, 0, 0); this.region = region; @@ -2382,7 +2382,7 @@ int /*long*/ fixedMapProc (int /*long*/ widget) { OS.g_list_free (widgetList); } if (gtk_widget_get_has_window (widget)) { - OS.gdk_window_show_unraised (OS.GTK_WIDGET_WINDOW (widget)); + OS.gdk_window_show_unraised (gtk_widget_get_window (widget)); } return 0; } @@ -3199,7 +3199,7 @@ int /*long*/ gtk_preedit_changed (int /*long*/ imcontext) { int /*long*/ gtk_realize (int /*long*/ widget) { int /*long*/ imHandle = imHandle (); if (imHandle != 0) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ()); + int /*long*/ window = gtk_widget_get_window (paintHandle ()); OS.gtk_im_context_set_client_window (imHandle, window); } if (backgroundImage != null) { @@ -3891,7 +3891,7 @@ public void setBackgroundImage (Image image) { } void setBackgroundPixmap (Image image) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ()); + int /*long*/ window = gtk_widget_get_window (paintHandle ()); if (window != 0) { if (image.pixmap != 0) { OS.gdk_window_set_back_pixmap (window, image.pixmap, false); @@ -4068,7 +4068,7 @@ public void setEnabled (boolean enabled) { if (!OS.GDK_WINDOWING_X11 ()) { OS.gdk_window_raise (enableWindow); } else { - restackWindow (enableWindow, OS.GTK_WIDGET_WINDOW (topHandle), true); + restackWindow (enableWindow, gtk_widget_get_window (topHandle), true); } if (gtk_widget_get_visible (topHandle)) OS.gdk_window_show_unraised (enableWindow); } @@ -4615,7 +4615,7 @@ void setZOrder (Control sibling, boolean above, boolean fixRelations, boolean fi int /*long*/ topHandle = topHandle (); int /*long*/ siblingHandle = sibling != null ? sibling.topHandle () : 0; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle); + int /*long*/ window = gtk_widget_get_window (topHandle); if (window != 0) { int /*long*/ siblingWindow = 0; if (sibling != null) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java index 4631d4d3b5..d478017676 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java @@ -1011,7 +1011,12 @@ void createDisplay (DeviceData data) { OS.gdk_window_add_filter (0, filterProc, 0); if (OS.GDK_WINDOWING_X11 ()) { - int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (OS.GTK_WIDGET_WINDOW (shellHandle)); + int /*long*/ xWindow; + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + xWindow = OS.gdk_x11_drawable_get_xid (OS.gtk_widget_get_window (shellHandle)); + } else { + xWindow = OS.gdk_x11_drawable_get_xid (OS.GTK_WIDGET_WINDOW (shellHandle)); + } byte[] atomName = Converter.wcsToMbcs (null, "SWT_Window_" + APP_NAME, true); //$NON-NLS-1$ int /*long*/ atom = OS.XInternAtom (xDisplay, atomName, false); OS.XSetSelectionOwner (xDisplay, atom, xWindow, OS.CurrentTime); @@ -4220,7 +4225,12 @@ int /*long*/ signalProc (int /*long*/ gobject, int /*long*/ arg1, int /*long*/ u byte[] name = Converter.wcsToMbcs (null, "org.eclipse.swt.filePath.message", true); //$NON-NLS-1$ int /*long*/ atom = OS.gdk_x11_atom_to_xatom (OS.gdk_atom_intern (name, true)); if (atom == OS.gdk_x11_atom_to_xatom (gdkEvent.atom)) { - int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (OS.GTK_WIDGET_WINDOW( shellHandle)); + int /*long*/ xWindow; + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + xWindow = OS.gdk_x11_drawable_get_xid (OS.gtk_widget_get_window( shellHandle)); + } else { + xWindow = OS.gdk_x11_drawable_get_xid (OS.GTK_WIDGET_WINDOW( shellHandle)); + } int /*long*/ [] type = new int /*long*/ [1]; int [] format = new int [1]; int [] nitems = new int [1]; 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 519cd150b2..65c035644f 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 @@ -375,7 +375,7 @@ void fixMenus (Decorations newParent) { if (!gtk_widget_get_mapped (handle)) { return new Rectangle (0, 0, 0, 0); } - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window = gtk_widget_get_window (handle); int [] origin_x = new int [1], origin_y = new int [1]; OS.gdk_window_get_origin (window, origin_x, origin_y); int x = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java index 0094b87af4..036c84cb51 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java @@ -145,7 +145,7 @@ void createHandle (int index) { void drawBand (int x, int y, int width, int height) { if ((style & SWT.SMOOTH) != 0) return; //TODO: Use Cairo - int /*long*/ window = OS.GTK_WIDGET_WINDOW (parent.paintHandle()); + int /*long*/ window = gtk_widget_get_window (parent.paintHandle()); if (window == 0) return; byte [] bits = {-86, 85, -86, 85, -86, 85, -86, 85}; int /*long*/ stipplePixmap = OS.gdk_bitmap_create_from_data (window, bits, 8, 8); @@ -172,7 +172,7 @@ int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ eventPtr) if (button != 1) return 0; if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) return 0; if (gdkEvent.type == OS.GDK_3BUTTON_PRESS) return 0; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (widget); + int /*long*/ window = gtk_widget_get_window (widget); int [] origin_x = new int [1], origin_y = new int [1]; OS.gdk_window_get_origin (window, origin_x, origin_y); startX = (int) (gdkEvent.x_root - origin_x [0]); @@ -329,7 +329,7 @@ int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ eventPtr) { if (newX == lastX && newY == lastY) return result; /* Ensure that the pointer image does not change */ - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window = gtk_widget_get_window (handle); int grabMask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK; int /*long*/ gdkCursor = cursor != null ? cursor.handle : defaultCursor; int ptrGrabResult = OS.gdk_pointer_grab (window, false, grabMask, window, gdkCursor, OS.GDK_CURRENT_TIME); 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 8172a57080..3bcf23ded3 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 @@ -368,11 +368,11 @@ public Rectangle getThumbBounds () { } Rectangle rect = new Rectangle(x, y, width, height); int [] origin_x = new int [1], origin_y = new int [1]; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (parent.scrolledHandle); + int /*long*/ window = gtk_widget_get_window (parent.scrolledHandle); if (window != 0) OS.gdk_window_get_origin (window, origin_x, origin_y); rect.x += origin_x [0]; rect.y += origin_y [0]; - window = OS.GTK_WIDGET_WINDOW (parent.handle); + window = gtk_widget_get_window (parent.handle); if (window != 0) OS.gdk_window_get_origin (window, origin_x, origin_y); rect.x -= origin_x [0]; rect.y -= origin_y [0]; @@ -456,11 +456,11 @@ public Rectangle getThumbTrackBounds () { } Rectangle rect = new Rectangle(x, y, width, height); int [] origin_x = new int [1], origin_y = new int [1]; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (parent.scrolledHandle); + int /*long*/ window = gtk_widget_get_window (parent.scrolledHandle); if (window != 0) OS.gdk_window_get_origin (window, origin_x, origin_y); rect.x += origin_x [0]; rect.y += origin_y [0]; - window = OS.GTK_WIDGET_WINDOW (parent.handle); + window = gtk_widget_get_window (parent.handle); if (window != 0) OS.gdk_window_get_origin (window, origin_x, origin_y); rect.x -= origin_x [0]; rect.y -= origin_y [0]; 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 a2e8c07f8a..697d33939f 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 @@ -374,7 +374,7 @@ void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boole if (!trim) return; int /*long*/ topHandle = topHandle (), paintHandle = paintHandle (); if (topHandle == paintHandle) return; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle); + int /*long*/ window = gtk_widget_get_window (topHandle); GdkRectangle rect = new GdkRectangle (); if (redrawAll) { GtkAllocation allocation = new GtkAllocation (); 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 8b376ae180..b173703434 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 @@ -462,7 +462,7 @@ void adjustTrim () { width = OS.GTK_WIDGET_WIDTH (shellHandle); height = OS.GTK_WIDGET_HEIGHT (shellHandle); } - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); GdkRectangle rect = new GdkRectangle (); OS.gdk_window_get_frame_extents (window, rect); int trimWidth = Math.max (0, rect.width - width); @@ -545,7 +545,7 @@ void bringToTop (boolean force) { * window. The fix is to use XSetInputFocus() to force * the focus. */ - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); if ((xFocus || (style & SWT.ON_TOP) != 0) && OS.GDK_WINDOWING_X11 ()) { int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (window); @@ -747,7 +747,7 @@ int /*long*/ filterProc (int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long* sendEvent (SWT.Activate); if (isDisposed ()) return 0; if (isCustomResize ()) { - OS.gdk_window_invalidate_rect (OS.GTK_WIDGET_WINDOW (shellHandle), null, false); + OS.gdk_window_invalidate_rect (gtk_widget_get_window (shellHandle), null, false); } break; } @@ -770,8 +770,9 @@ int /*long*/ filterProc (int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long* display.activePending = false; } if (isDisposed ()) return 0; - if (isCustomResize ()) { - OS.gdk_window_invalidate_rect (OS.GTK_WIDGET_WINDOW (shellHandle), null, false); + if (isCustomResize ()) { + OS.gdk_window_invalidate_rect (gtk_widget_get_window (shellHandle), null, false); + } break; } @@ -824,7 +825,7 @@ void hookEvents () { OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [MAP_EVENT], 0, display.shellMapProcClosure, false); OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [ENTER_NOTIFY_EVENT], 0, display.closures [ENTER_NOTIFY_EVENT], false); OS.g_signal_connect_closure (shellHandle, OS.move_focus, display.closures [MOVE_FOCUS], false); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); OS.gdk_window_add_filter (window, display.filterProc, shellHandle); if (isCustomResize ()) { int mask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK | OS.GDK_BUTTON_PRESS_MASK | OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK; @@ -1252,7 +1253,7 @@ int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ event) { GdkEventExpose gdkEventExpose = new GdkEventExpose (); OS.memmove (gdkEventExpose, event, GdkEventExpose.sizeof); int /*long*/ style = OS.gtk_widget_get_style (widget); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (widget); + int /*long*/ window = gtk_widget_get_window (widget); int [] width = new int [1]; int [] height = new int [1]; OS.gdk_drawable_get_size (window, width, height); @@ -1299,7 +1300,7 @@ int /*long*/ gtk_leave_notify_event (int /*long*/ widget, int /*long*/ event) { GdkEventCrossing gdkEvent = new GdkEventCrossing (); OS.memmove (gdkEvent, event, GdkEventCrossing.sizeof); if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) == 0) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); OS.gdk_window_set_cursor (window, 0); display.resizeMode = 0; } @@ -1371,14 +1372,14 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) { break; } if (x != display.resizeBoundsX || y != display.resizeBoundsY) { - OS.gdk_window_move_resize (OS.GTK_WIDGET_WINDOW (shellHandle), x, y, width, height); + OS.gdk_window_move_resize (gtk_widget_get_window (shellHandle), x, y, width, height); } else { OS.gtk_window_resize (shellHandle, width, height); } } else { int mode = getResizeMode (gdkEvent.x, gdkEvent.y); if (mode != display.resizeMode) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); int /*long*/ cursor = OS.gdk_cursor_new (mode); OS.gdk_window_set_cursor (window, cursor); OS.gdk_cursor_unref (cursor); @@ -1445,7 +1446,7 @@ int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) { int /*long*/ gtk_realize (int /*long*/ widget) { int /*long*/ result = super.gtk_realize (widget); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); if ((style & SWT.SHELL_TRIM) != SWT.SHELL_TRIM) { int decorations = 0; if ((style & SWT.NO_TRIM) == 0) { @@ -1780,7 +1781,7 @@ public void setEnabled (boolean enabled) { } else { int /*long*/ parentHandle = shellHandle; OS.gtk_widget_realize (parentHandle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (parentHandle); + int /*long*/ window = gtk_widget_get_window (parentHandle); Rectangle rect = getBounds (); GdkWindowAttr attributes = new GdkWindowAttr (); attributes.width = rect.width; @@ -2463,7 +2464,7 @@ void releaseWidget () { tooltipsHandle = 0; if (group != 0) OS.g_object_unref (group); group = modalGroup = 0; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); + int /*long*/ window = gtk_widget_get_window (shellHandle); OS.gdk_window_remove_filter(window, display.filterProc, shellHandle); lastActive = null; } @@ -2498,7 +2499,7 @@ void setToolTipText (int /*long*/ rootWidget, int /*long*/ tipWidget, String str * contain the proper x and y coordinates. */ int /*long*/ eventPtr = 0; - int /*long*/ tipWindow = OS.GTK_WIDGET_WINDOW (rootWidget); + int /*long*/ tipWindow = gtk_widget_get_window (rootWidget); if (tipWindow != 0) { int [] x = new int [1], y = new int [1]; int /*long*/ window = OS.gdk_window_at_pointer (x, y); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java index 5b27e9ad3b..240749f2ea 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java @@ -1119,7 +1119,7 @@ public Rectangle getClientArea () { checkWidget (); forceResize (); OS.gtk_widget_realize (handle); - int /*long*/ fixedWindow = OS.GTK_WIDGET_WINDOW (fixedHandle); + int /*long*/ fixedWindow = gtk_widget_get_window (fixedHandle); int /*long*/ binWindow = OS.gtk_tree_view_get_bin_window (handle); int [] binX = new int [1], binY = new int [1]; OS.gdk_window_get_origin (binWindow, binX, binY); @@ -1366,7 +1366,7 @@ public int getHeaderHeight () { return height; } OS.gtk_widget_realize (handle); - int /*long*/ fixedWindow = OS.GTK_WIDGET_WINDOW (fixedHandle); + int /*long*/ fixedWindow = gtk_widget_get_window (fixedHandle); int /*long*/ binWindow = OS.gtk_tree_view_get_bin_window (handle); int [] binY = new int [1]; OS.gdk_window_get_origin (binWindow, null, binY); 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 53ef0845bc..13425ad071 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 @@ -137,7 +137,7 @@ public void addSelectionListener (SelectionListener listener) { void configure () { int /*long*/ screen = OS.gdk_screen_get_default (); OS.gtk_widget_realize (handle); - int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, OS.GTK_WIDGET_WINDOW (handle)); + int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (handle)); GdkRectangle dest = new GdkRectangle (); OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest); Point point = getSize (dest.width / 4); @@ -251,7 +251,7 @@ void configure () { } int /*long*/ rgn = OS.gdk_region_polygon (polyline, polyline.length / 2, OS.GDK_EVEN_ODD_RULE); OS.gtk_widget_realize (handle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window = gtk_widget_get_window (handle); OS.gdk_window_shape_combine_region (window, rgn, 0, 0); OS.gdk_region_destroy (rgn); } @@ -345,7 +345,7 @@ Point getLocation () { y = area.y + area.height / 2; } else { OS.gtk_widget_realize (itemHandle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (itemHandle); + int /*long*/ window = gtk_widget_get_window (itemHandle); int [] px = new int [1], py = new int [1]; OS.gdk_window_get_origin (window, px, py); x = px [0] + OS.GTK_WIDGET_WIDTH (itemHandle) / 2; @@ -480,7 +480,7 @@ int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) { int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ eventPtr) { if ((state & OBSCURED) != 0) return 0; - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window = gtk_widget_get_window (handle); int x = BORDER + PADDING; int y = BORDER + PADDING; if (OS.USE_CAIRO) { @@ -587,7 +587,7 @@ int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) { int y = point.y; int /*long*/ screen = OS.gdk_screen_get_default (); OS.gtk_widget_realize (widget); - int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, OS.GTK_WIDGET_WINDOW (widget)); + int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget)); GdkRectangle dest = new GdkRectangle (); OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest); int w = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java index 812ce787bc..af86c4f365 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java @@ -308,7 +308,7 @@ Rectangle [] computeProportions (Rectangle [] rects) { void drawRectangles (Rectangle [] rects) { int /*long*/ window = OS.gdk_get_default_root_window(); if (parent != null) { - window = OS.GTK_WIDGET_WINDOW (parent.paintHandle()); + window = gtk_widget_get_window (parent.paintHandle()); } if (window == 0) return; //TODO: Use Cairo @@ -664,7 +664,7 @@ public boolean open () { checkWidget(); window = OS.gdk_get_default_root_window(); if (parent != null) { - window = OS.GTK_WIDGET_WINDOW (parent.paintHandle()); + window = gtk_widget_get_window (parent.paintHandle()); } if (window == 0) return false; cancelled = false; 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 ac59b4c9c0..108a0830a0 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 @@ -348,7 +348,7 @@ int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) { } } OS.gtk_widget_realize (handle); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); + int /*long*/ window = gtk_widget_get_window (handle); OS.gdk_window_shape_combine_region (window, region.handle, 0, 0); region.dispose (); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index 58842aaf64..94065d380d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -1120,7 +1120,7 @@ public Rectangle getClientArea () { checkWidget (); forceResize (); OS.gtk_widget_realize (handle); - int /*long*/ fixedWindow = OS.GTK_WIDGET_WINDOW (fixedHandle); + int /*long*/ fixedWindow = gtk_widget_get_window (fixedHandle); int /*long*/ binWindow = OS.gtk_tree_view_get_bin_window (handle); int [] binX = new int [1], binY = new int [1]; OS.gdk_window_get_origin (binWindow, binX, binY); @@ -1377,7 +1377,7 @@ public int getHeaderHeight () { return height; } OS.gtk_widget_realize (handle); - int /*long*/ fixedWindow = OS.GTK_WIDGET_WINDOW (fixedHandle); + int /*long*/ fixedWindow = gtk_widget_get_window (fixedHandle); int /*long*/ binWindow = OS.gtk_tree_view_get_bin_window (handle); int [] binY = new int [1]; OS.gdk_window_get_origin (binWindow, null, binY); 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 3f019dec9f..0c8ec24ccd 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 @@ -1738,6 +1738,14 @@ boolean gtk_widget_get_has_window (int /*long*/ widget) { } } +int /*long*/ gtk_widget_get_window (int /*long*/ widget){ + if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + return OS.gtk_widget_get_window (widget); + } else { + return OS.GTK_WIDGET_WINDOW (widget); + } +} + /** * Returns a string containing a concise, human-readable * description of the receiver. -- cgit