diff options
author | Alexander Kurtakov <akurtako@redhat.com> | 2012-10-03 00:42:22 +0300 |
---|---|---|
committer | Alexander Kurtakov <akurtako@redhat.com> | 2012-10-03 00:42:22 +0300 |
commit | 26da329d593c3d3e2d59fbd6c7fdc55bac80984c (patch) | |
tree | 94abbbe4d54f9059416dd455dbd641504a118abc | |
parent | 09f1692137fcd35dbae7ea8049913ec763ba69df (diff) | |
download | eclipse.platform.swt-26da329d593c3d3e2d59fbd6c7fdc55bac80984c.tar.gz eclipse.platform.swt-26da329d593c3d3e2d59fbd6c7fdc55bac80984c.tar.xz eclipse.platform.swt-26da329d593c3d3e2d59fbd6c7fdc55bac80984c.zip |
Make use of gdk_x11_window_get_xid instead of gdk_x11_drawable_get_xid.
The former is a replacement for the later in GTK3.
9 files changed, 67 insertions, 7 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 83145d88e1..5577ec928a 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 @@ -203,7 +203,9 @@ public static Frame new_Frame (final Composite parent) { long /*int*/ awtHandle = getAWTHandle(window); if (awtHandle == 0) return; long /*int*/ xWindow; - if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + xWindow = OS.gdk_x11_window_get_xid (OS.gtk_widget_get_window (shell.handle)); + } else 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))); 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 f997d6e745..a266168f81 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 @@ -138,7 +138,11 @@ public GLCanvas (Composite parent, int style, GLData data) { glWindow = OS.gdk_window_new (window, attrs, OS.GDK_WA_VISUAL); OS.gdk_window_set_user_data (glWindow, handle); if ((style & SWT.NO_BACKGROUND) != 0) OS.gdk_window_set_back_pixmap (window, 0, false); - xWindow = OS.gdk_x11_drawable_get_xid (glWindow); + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + xWindow = OS.gdk_x11_window_get_xid (glWindow); + } else { + xWindow = OS.gdk_x11_drawable_get_xid (glWindow); + } OS.gdk_window_show (glWindow); Listener listener = new Listener () { 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 90dbaf87ed..918903fe4b 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 @@ -7386,7 +7386,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1drawable_1get_1xid) { jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gdk_1x11_1drawable_1get_1xid_FUNC); - rc = (jintLong)gdk_x11_drawable_get_xid((GdkDrawable *)arg0); +/* + rc = (jintLong)gdk_x11_drawable_get_xid(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_x11_drawable_get_xid) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } OS_NATIVE_EXIT(env, that, _1gdk_1x11_1drawable_1get_1xid_FUNC); return rc; } @@ -7444,6 +7452,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1visual_1get_1xvisual) } #endif +#ifndef NO__1gdk_1x11_1window_1get_1xid +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1window_1get_1xid) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gdk_1x11_1window_1get_1xid_FUNC); +/* + rc = (jintLong)gdk_x11_window_get_xid((GdkWindow *)arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_x11_window_get_xid) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkWindow *))fp)((GdkWindow *)arg0); + } + } + OS_NATIVE_EXIT(env, that, _1gdk_1x11_1window_1get_1xid_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1x11_1window_1lookup_1for_1display JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1window_1lookup_1for_1display) (JNIEnv *env, jclass that, jintLong arg0, jintLong 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 9aa4938032..d04f034f51 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 @@ -265,6 +265,8 @@ #define gdk_x11_screen_lookup_visual_LIB LIB_GDK #define gdk_x11_window_lookup_for_display_LIB LIB_GDK #define gdk_x11_display_utf8_to_compound_text_LIB LIB_GDK +#define gdk_x11_drawable_get_xid_LIB LIB_GDK +#define gdk_x11_window_get_xid_LIB LIB_GDK #define gdk_utf8_to_compound_text_LIB LIB_GDK #define gdk_threads_set_lock_functions_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 ed61f72f13..93ada249c5 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 @@ -584,6 +584,7 @@ char * OS_nativeFunctionNames[] = { "_1gdk_1x11_1screen_1get_1window_1manager_1name", "_1gdk_1x11_1screen_1lookup_1visual", "_1gdk_1x11_1visual_1get_1xvisual", + "_1gdk_1x11_1window_1get_1xid", "_1gdk_1x11_1window_1lookup_1for_1display", "_1glib_1major_1version", "_1glib_1micro_1version", 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 cf4b050c5f..a387f15493 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 @@ -594,6 +594,7 @@ typedef enum { _1gdk_1x11_1screen_1get_1window_1manager_1name_FUNC, _1gdk_1x11_1screen_1lookup_1visual_FUNC, _1gdk_1x11_1visual_1get_1xvisual_FUNC, + _1gdk_1x11_1window_1get_1xid_FUNC, _1gdk_1x11_1window_1lookup_1for_1display_FUNC, _1glib_1major_1version_FUNC, _1glib_1micro_1version_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 b59248a1c5..11ce8468ba 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 @@ -1162,7 +1162,7 @@ public static final long /*int*/ gdk_x11_drawable_get_xdisplay(long /*int*/ draw lock.unlock(); } } -/** @param drawable cast=(GdkDrawable *) */ +/** @method flags=dynamic */ public static final native long /*int*/ _gdk_x11_drawable_get_xid(long /*int*/ drawable); public static final long /*int*/ gdk_x11_drawable_get_xid(long /*int*/ drawable) { lock.lock(); @@ -1210,6 +1210,19 @@ public static final long /*int*/ gdk_x11_visual_get_xvisual(long /*int*/ visual) } } /** +* @method flags=dynamic +* @param gdkwindow cast=(GdkWindow *) +*/ +public static final native long /*int*/ _gdk_x11_window_get_xid(long /*int*/ gdkwindow); +public static final long /*int*/ gdk_x11_window_get_xid(long /*int*/ gdkwindow) { + lock.lock(); + try { + return _gdk_x11_window_get_xid(gdkwindow); + } finally { + lock.unlock(); + } +} +/** * @method flags=dynamic * @param gdkdisplay cast=(GdkDisplay *) */ 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 ef377a6761..eb66197b83 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 @@ -1012,7 +1012,9 @@ void createDisplay (DeviceData data) { if (OS.GDK_WINDOWING_X11 ()) { long /*int*/ xWindow; - if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + xWindow = OS.gdk_x11_window_get_xid (OS.gtk_widget_get_window (shellHandle)); + } else 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)); @@ -4228,7 +4230,9 @@ long /*int*/ signalProc (long /*int*/ gobject, long /*int*/ arg1, long /*int*/ u long /*int*/ atom = OS.gdk_x11_atom_to_xatom (OS.gdk_atom_intern (name, true)); if (atom == OS.gdk_x11_atom_to_xatom (gdkEvent.atom)) { long /*int*/ xWindow; - if (OS.GTK_VERSION >= OS.VERSION(2, 14, 0)){ + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + xWindow = OS.gdk_x11_window_get_xid (OS.gtk_widget_get_window (shellHandle)); + } else 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)); 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 73b4c6c806..4b0e578adc 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 @@ -558,7 +558,12 @@ void bringToTop (boolean force) { long /*int*/ window = gtk_widget_get_window (shellHandle); if ((xFocus || (style & SWT.ON_TOP) != 0) && OS.GDK_WINDOWING_X11 ()) { long /*int*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); - long /*int*/ xWindow = OS.gdk_x11_drawable_get_xid (window); + long /*int*/ xWindow; + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + xWindow = OS.gdk_x11_window_get_xid (window); + } else { + xWindow = OS.gdk_x11_drawable_get_xid (window); + } OS.gdk_error_trap_push (); /* Use CurrentTime instead of the last event time to ensure that the shell becomes active */ OS.XSetInputFocus (xDisplay, xWindow, OS.RevertToParent, OS.CurrentTime); |