diff options
author | Alexander Kurtakov <akurtako@redhat.com> | 2012-10-03 18:40:31 +0300 |
---|---|---|
committer | Alexander Kurtakov <akurtako@redhat.com> | 2012-10-03 18:40:31 +0300 |
commit | 265077a96d57dc2a0b297a8aed26edc86ff6299e (patch) | |
tree | 87476da0de4ad5a0d179802e03a2d2e78aeb16b4 | |
parent | 26da329d593c3d3e2d59fbd6c7fdc55bac80984c (diff) | |
download | eclipse.platform.swt-265077a96d57dc2a0b297a8aed26edc86ff6299e.tar.gz eclipse.platform.swt-265077a96d57dc2a0b297a8aed26edc86ff6299e.tar.xz eclipse.platform.swt-265077a96d57dc2a0b297a8aed26edc86ff6299e.zip |
Conditional usage of gdk_x11_drawable_get_xdisplay.
Replaced with gdk_x11_display_get_xdisplay calls where needed and make
gdk_x11_drawable_get_xdisplay dynamic.
5 files changed, 31 insertions, 7 deletions
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 a266168f81..5866c09e2c 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 @@ -171,7 +171,7 @@ public GLCanvas (Composite parent, int style, GLData data) { } else { window = OS.GTK_WIDGET_WINDOW (handle); } - long /*int*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); + long /*int*/ xDisplay = gdk_x11_display_get_xdisplay (window); if (context != 0) { if (GLX.glXGetCurrentContext () == context) { GLX.glXMakeCurrent (xDisplay, 0, 0); @@ -209,7 +209,7 @@ public GLData getGLData () { } else { window = OS.GTK_WIDGET_WINDOW (handle); } - long /*int*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); + long /*int*/ xDisplay = gdk_x11_display_get_xdisplay (window); GLData data = new GLData (); int [] value = new int [1]; GLX.glXGetConfig (xDisplay, vinfo, GLX.GLX_DOUBLEBUFFER, value); @@ -272,7 +272,7 @@ public void setCurrent () { checkWidget (); if (GLX.glXGetCurrentContext () == context) return; long /*int*/ window = OS.GTK_WIDGET_WINDOW (handle); - long /*int*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); + long /*int*/ xDisplay = gdk_x11_display_get_xdisplay (window); GLX.glXMakeCurrent (xDisplay, xWindow, context); } @@ -287,7 +287,17 @@ public void setCurrent () { public void swapBuffers () { checkWidget (); long /*int*/ window = OS.GTK_WIDGET_WINDOW (handle); - long /*int*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); + long /*int*/ xDisplay = gdk_x11_display_get_xdisplay (window); GLX.glXSwapBuffers (xDisplay, xWindow); } + +private long /*int*/ gdk_x11_display_get_xdisplay(long /*int*/ window) { + long /*int*/ xdisplay; + if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) { + xdisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_window_get_display(window)); + } else { + xdisplay = OS.gdk_x11_drawable_get_xdisplay (window); + } + return xdisplay; +} } 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 918903fe4b..41591d00eb 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 @@ -7374,7 +7374,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1drawable_1get_1xdisplay) { jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gdk_1x11_1drawable_1get_1xdisplay_FUNC); - rc = (jintLong)gdk_x11_drawable_get_xdisplay((GdkDrawable *)arg0); +/* + rc = (jintLong)gdk_x11_drawable_get_xdisplay(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gdk_x11_drawable_get_xdisplay) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } OS_NATIVE_EXIT(env, that, _1gdk_1x11_1drawable_1get_1xdisplay_FUNC); return rc; } 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 d04f034f51..e93874f469 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,7 @@ #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_xdisplay_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 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 11ce8468ba..1e5aa121aa 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 @@ -1152,7 +1152,7 @@ public static final long /*int*/ gdk_x11_display_get_xdisplay (long /*int*/ gdkd lock.unlock(); } } -/** @param drawable cast=(GdkDrawable *) */ +/** @method flags=dynamic */ public static final native long /*int*/ _gdk_x11_drawable_get_xdisplay(long /*int*/ drawable); public static final long /*int*/ gdk_x11_drawable_get_xdisplay(long /*int*/ drawable) { lock.lock(); 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 4b0e578adc..2306ee6270 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 @@ -557,7 +557,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*/ xDisplay; + if (OS.GTK_VERSION >= OS.VERSION(2, 24, 0)) { + xDisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_window_get_display(window)); + } else { + xDisplay = OS.gdk_x11_drawable_get_xdisplay (window); + } long /*int*/ xWindow; if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { xWindow = OS.gdk_x11_window_get_xid (window); |