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 c7efe27d53..d6325f3e78 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 @@ -53,6 +53,18 @@ JNIEXPORT jlong JNICALL GDK_NATIVE(GDK_1EVENT_1WINDOW) } #endif +#ifndef NO_GDK_1IS_1WAYLAND_1DISPLAY +JNIEXPORT jboolean JNICALL GDK_NATIVE(GDK_1IS_1WAYLAND_1DISPLAY) + (JNIEnv *env, jclass that, jlong arg0) +{ + jboolean rc = 0; + GDK_NATIVE_ENTER(env, that, GDK_1IS_1WAYLAND_1DISPLAY_FUNC); + rc = (jboolean)GDK_IS_WAYLAND_DISPLAY((GdkDisplay *)arg0); + GDK_NATIVE_EXIT(env, that, GDK_1IS_1WAYLAND_1DISPLAY_FUNC); + return rc; +} +#endif + #ifndef NO_GDK_1IS_1X11_1DISPLAY JNIEXPORT jboolean JNICALL GDK_NATIVE(GDK_1IS_1X11_1DISPLAY) (JNIEnv *env, jclass that, jlong arg0) 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 a4c5cf60ba..eb51902dd8 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 @@ -71,8 +71,10 @@ #endif #if !GTK_CHECK_VERSION(4,0,0) #include +#include #else #include +#include #endif #else 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 a83c778d8e..3f2d597b3c 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 @@ -26,6 +26,7 @@ typedef enum { GDK_1EVENT_1TYPE_FUNC, GDK_1EVENT_1WINDOW_FUNC, + GDK_1IS_1WAYLAND_1DISPLAY_FUNC, GDK_1IS_1X11_1DISPLAY_FUNC, GDK_1TYPE_1PIXBUF_FUNC, GDK_1TYPE_1RGBA_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 7cbfdff3f2..1a2616ea43 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 @@ -247,6 +247,8 @@ public class GDK extends OS { /** @param event cast=(GdkEventAny *) */ public static final native long GDK_EVENT_WINDOW(long event); /** @param display cast=(GdkDisplay *) */ + public static final native boolean GDK_IS_WAYLAND_DISPLAY(long display); + /** @param display cast=(GdkDisplay *) */ public static final native boolean GDK_IS_X11_DISPLAY(long display); /** @method flags=const */ public static final native long GDK_TYPE_RGBA(); 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 c319bbac70..2a8e3447a5 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 @@ -706,7 +706,7 @@ public static int VERSION(int major, int minor, int micro) { } public static boolean isWayland () { - return !isX11 (); + return OS.GDK_WINDOWING_WAYLAND() && GDK.GDK_IS_WAYLAND_DISPLAY(GDK.gdk_display_get_default()); } public static boolean isX11 () {