diff options
author | Eric Williams | 2018-11-14 16:52:01 +0000 |
---|---|---|
committer | Eric Williams | 2018-11-14 17:00:28 +0000 |
commit | ceb37cce8c362c7a074ea817dd3671cdbcbf48a1 (patch) | |
tree | 9bd60a86805f4c6fd0ff46ab8912aef4585e9992 | |
parent | 50572470530bb6c771a763e1cc3efa5e2b5b6e0d (diff) | |
download | eclipse.platform.swt-I20181114-1325.tar.gz eclipse.platform.swt-I20181114-1325.tar.xz eclipse.platform.swt-I20181114-1325.zip |
Bug 541157: [GTK4] Clean up X11 functionsI20181114-1325
Handle certain X11 functions that have changed name on GTK4, or were
removed.
Change-Id: Ibff445ebf735d0251d7280404954911574cbe441
Signed-off-by: Eric Williams <ericwill@redhat.com>
6 files changed, 112 insertions, 13 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 4fad2d06a4..23ec47ab36 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 @@ -2626,7 +2626,15 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1x11_1screen_1get_1window_1manager_1 { jintLong rc = 0; GDK_NATIVE_ENTER(env, that, _1gdk_1x11_1screen_1get_1window_1manager_1name_FUNC); - rc = (jintLong)gdk_x11_screen_get_window_manager_name((GdkScreen *)arg0); +/* + rc = (jintLong)gdk_x11_screen_get_window_manager_name(arg0); +*/ + { + GDK_LOAD_FUNCTION(fp, gdk_x11_screen_get_window_manager_name) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } GDK_NATIVE_EXIT(env, that, _1gdk_1x11_1screen_1get_1window_1manager_1name_FUNC); return rc; } @@ -2638,19 +2646,59 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1x11_1screen_1lookup_1visual) { jintLong rc = 0; GDK_NATIVE_ENTER(env, that, _1gdk_1x11_1screen_1lookup_1visual_FUNC); - rc = (jintLong)gdk_x11_screen_lookup_visual((GdkScreen *)arg0, (VisualID)arg1); +/* + rc = (jintLong)gdk_x11_screen_lookup_visual(arg0, (VisualID)arg1); +*/ + { + GDK_LOAD_FUNCTION(fp, gdk_x11_screen_lookup_visual) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, VisualID))fp)(arg0, (VisualID)arg1); + } + } GDK_NATIVE_EXIT(env, that, _1gdk_1x11_1screen_1lookup_1visual_FUNC); return rc; } #endif +#ifndef NO__1gdk_1x11_1surface_1get_1xid +JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1x11_1surface_1get_1xid) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + GDK_NATIVE_ENTER(env, that, _1gdk_1x11_1surface_1get_1xid_FUNC); + rc = (jintLong)gdk_x11_surface_get_xid((GdkSurface *)arg0); + GDK_NATIVE_EXIT(env, that, _1gdk_1x11_1surface_1get_1xid_FUNC); + return rc; +} +#endif + +#ifndef NO__1gdk_1x11_1surface_1lookup_1for_1display +JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1x11_1surface_1lookup_1for_1display) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jintLong rc = 0; + GDK_NATIVE_ENTER(env, that, _1gdk_1x11_1surface_1lookup_1for_1display_FUNC); + rc = (jintLong)gdk_x11_surface_lookup_for_display((GdkDisplay *)arg0, (Window)arg1); + GDK_NATIVE_EXIT(env, that, _1gdk_1x11_1surface_1lookup_1for_1display_FUNC); + return rc; +} +#endif + #ifndef NO__1gdk_1x11_1visual_1get_1xvisual JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1x11_1visual_1get_1xvisual) (JNIEnv *env, jclass that, jintLong arg0) { jintLong rc = 0; GDK_NATIVE_ENTER(env, that, _1gdk_1x11_1visual_1get_1xvisual_FUNC); - rc = (jintLong)gdk_x11_visual_get_xvisual((GdkVisual *)arg0); +/* + rc = (jintLong)gdk_x11_visual_get_xvisual(arg0); +*/ + { + GDK_LOAD_FUNCTION(fp, gdk_x11_visual_get_xvisual) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } GDK_NATIVE_EXIT(env, that, _1gdk_1x11_1visual_1get_1xvisual_FUNC); return rc; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h index d207c21ec7..9e295d72f4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h @@ -100,9 +100,21 @@ #endif -#if defined(GDK_WINDOWING_X11) && !GTK_CHECK_VERSION(3,94,0) -#include <gdk/gdkx.h> +#if defined(GDK_WINDOWING_X11) +#if !GTK_CHECK_VERSION(3,94,0) #include <gtk/gtkx.h> +#define NO__1gdk_1x11_1surface_1get_1xid +#define NO__1gdk_1x11_1surface_1lookup_1for_1display +#else +#define NO__1gdk_1x11_1get_1default_1xdisplay +#define NO__1gdk_1x11_1window_1get_1xid +#define NO__1gdk_1x11_1window_1lookup_1for_1display +#define NO__1GTK_1IS_1PLUG +#define NO__1gtk_1plug_1new +#define NO__1gtk_1socket_1get_1id +#define NO__1gtk_1socket_1new +#endif +#include <gdk/gdkx.h> #else #define NO_GDK_1IS_1X11_1DISPLAY 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 d99f20f821..3b9225605b 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 @@ -220,6 +220,8 @@ char * GDK_nativeFunctionNames[] = { "_1gdk_1x11_1get_1default_1xdisplay", "_1gdk_1x11_1screen_1get_1window_1manager_1name", "_1gdk_1x11_1screen_1lookup_1visual", + "_1gdk_1x11_1surface_1get_1xid", + "_1gdk_1x11_1surface_1lookup_1for_1display", "_1gdk_1x11_1visual_1get_1xvisual", "_1gdk_1x11_1window_1get_1xid", "_1gdk_1x11_1window_1lookup_1for_1display", 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 903397cc8b..2e824c0d45 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 @@ -230,6 +230,8 @@ typedef enum { _1gdk_1x11_1get_1default_1xdisplay_FUNC, _1gdk_1x11_1screen_1get_1window_1manager_1name_FUNC, _1gdk_1x11_1screen_1lookup_1visual_FUNC, + _1gdk_1x11_1surface_1get_1xid_FUNC, + _1gdk_1x11_1surface_1lookup_1for_1display_FUNC, _1gdk_1x11_1visual_1get_1xvisual_FUNC, _1gdk_1x11_1window_1get_1xid_FUNC, _1gdk_1x11_1window_1lookup_1for_1display_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java index da1e07b054..67db51c124 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java @@ -323,10 +323,11 @@ public class GDK extends OS { } } /** - * @param screen cast=(GdkScreen *) + * @method flags=dynamic * @param xvisualid cast=(VisualID) */ public static final native long /*int*/ _gdk_x11_screen_lookup_visual(long /*int*/ screen, int xvisualid); + /** [GTK3/GTK4, GTK3 uses GdkScreen but GTK4 uses GdkX11Screen -- method signature otherwise identical] */ public static final long /*int*/ gdk_x11_screen_lookup_visual(long /*int*/ screen, int xvisualid) { lock.lock(); try { @@ -336,9 +337,10 @@ public class GDK extends OS { } } /** - * @param screen cast=(GdkScreen *) + * @method flags=dynamic */ public static final native long /*int*/ _gdk_x11_screen_get_window_manager_name(long /*int*/ screen); + /** [GTK3/GTK4, GTK3 uses GdkScreen but GTK4 uses GdkX11Screen -- method signature otherwise identical] */ public static final long /*int*/ gdk_x11_screen_get_window_manager_name(long /*int*/ screen) { lock.lock(); try { @@ -347,8 +349,11 @@ public class GDK extends OS { lock.unlock(); } } - /** @param visual cast=(GdkVisual *) */ + /** + * @method flags=dynamic + */ public static final native long /*int*/ _gdk_x11_visual_get_xvisual(long /*int*/ visual); + /** [GTK3/GTK4, GTK3 uses GdkVisual but GTK4 uses GdkX11Visual -- method signature otherwise identical] */ public static final long /*int*/ gdk_x11_visual_get_xvisual(long /*int*/ visual) { lock.lock(); try { @@ -361,12 +366,27 @@ public class GDK extends OS { * @param gdkwindow cast=(GdkWindow *) */ public static final native long /*int*/ _gdk_x11_window_get_xid(long /*int*/ gdkwindow); + /** [GTK3 only, if-def'd in os.h] */ 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(); + + } + } + /** + * @param surface cast=(GdkSurface *) + */ + public static final native long /*int*/ _gdk_x11_surface_get_xid(long /*int*/ surface); + /** [GTK4 only, if-def'd in os.h] */ + public static final long /*int*/ gdk_x11_surface_get_xid(long /*int*/ surface) { + lock.lock(); + try { + return _gdk_x11_surface_get_xid(surface); + } finally { + lock.unlock(); } } /** @@ -374,6 +394,7 @@ public class GDK extends OS { * @param xid cast=(Window) */ public static final native long /*int*/ _gdk_x11_window_lookup_for_display(long /*int*/ gdkdisplay, long /*int*/ xid); + /** [GTK3 only, if-def'd in os.h] */ public static final long /*int*/ gdk_x11_window_lookup_for_display(long /*int*/ gdkdisplay, long /*int*/ xid) { lock.lock(); try { @@ -383,6 +404,20 @@ public class GDK extends OS { } } /** + * @param gdkdisplay cast=(GdkDisplay *) + * @param xid cast=(Window) + */ + public static final native long /*int*/ _gdk_x11_surface_lookup_for_display(long /*int*/ gdkdisplay, long /*int*/ xid); + /** [GTK4 only, if-def'd in os.h] */ + public static final long /*int*/ gdk_x11_surface_lookup_for_display(long /*int*/ gdkdisplay, long /*int*/ xid) { + lock.lock(); + try { + return _gdk_x11_surface_lookup_for_display(gdkdisplay, xid); + } finally { + lock.unlock(); + } + } + /** * @param window cast=(GdkWindow *) * @param function cast=(GdkFilterFunc) * @param data cast=(gpointer) @@ -781,7 +816,7 @@ public class GDK extends OS { public static final long /*int*/ gdk_device_get_surface_at_position(long /*int*/ device, int[] win_x, int[] win_y) { lock.lock(); try { - return _gdk_device_get_window_at_position(device, win_x, win_y); + return _gdk_device_get_surface_at_position(device, win_x, win_y); } finally { lock.unlock(); } @@ -1946,7 +1981,7 @@ public class GDK extends OS { public static final long /*int*/ gdk_surface_create_similar_surface(long /*int*/ window, int content, int width, int height) { lock.lock(); try { - return _gdk_window_create_similar_surface(window, content, width, height); + return _gdk_surface_create_similar_surface(window, content, width, height); } finally { lock.unlock(); } @@ -1968,7 +2003,7 @@ public class GDK extends OS { public static final void gdk_surface_destroy(long /*int*/ window) { lock.lock(); try { - _gdk_window_destroy(window); + _gdk_surface_destroy(window); } finally { lock.unlock(); } @@ -2012,7 +2047,7 @@ public class GDK extends OS { public static final void gdk_surface_focus(long /*int*/ surface, int timestamp) { lock.lock(); try { - _gdk_window_focus(surface, timestamp); + _gdk_surface_focus(surface, timestamp); } finally { lock.unlock(); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java index 9fda0c823e..0531e922c9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java @@ -9242,7 +9242,7 @@ public class GTK extends OS { public static final void gtk_widget_set_parent_surface(long /*int*/ widget, long /*int*/ parent_surface) { lock.lock(); try { - _gtk_widget_set_parent_window(widget, parent_surface); + _gtk_widget_set_parent_surface(widget, parent_surface); } finally { lock.unlock(); } |