Skip to content

Commit 06e5e83

Browse files
committed
[GTK] Make isWayland real check
And not just !isX11(). There are other backends like broadway, windows, quartz.
1 parent d87a932 commit 06e5e83

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ JNIEXPORT jlong JNICALL GDK_NATIVE(GDK_1EVENT_1WINDOW)
5353
}
5454
#endif
5555

56+
#ifndef NO_GDK_1IS_1WAYLAND_1DISPLAY
57+
JNIEXPORT jboolean JNICALL GDK_NATIVE(GDK_1IS_1WAYLAND_1DISPLAY)
58+
(JNIEnv *env, jclass that, jlong arg0)
59+
{
60+
jboolean rc = 0;
61+
GDK_NATIVE_ENTER(env, that, GDK_1IS_1WAYLAND_1DISPLAY_FUNC);
62+
rc = (jboolean)GDK_IS_WAYLAND_DISPLAY((GdkDisplay *)arg0);
63+
GDK_NATIVE_EXIT(env, that, GDK_1IS_1WAYLAND_1DISPLAY_FUNC);
64+
return rc;
65+
}
66+
#endif
67+
5668
#ifndef NO_GDK_1IS_1X11_1DISPLAY
5769
JNIEXPORT jboolean JNICALL GDK_NATIVE(GDK_1IS_1X11_1DISPLAY)
5870
(JNIEnv *env, jclass that, jlong arg0)

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@
7171
#endif
7272
#if !GTK_CHECK_VERSION(4,0,0)
7373
#include <gdk/gdkx.h>
74+
#include <gdk/gdkwayland.h>
7475
#else
7576
#include <gdk/x11/gdkx.h>
77+
#include <gdk/wayland/gdkwayland.h>
7678
#endif
7779
#else
7880

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
typedef enum {
2727
GDK_1EVENT_1TYPE_FUNC,
2828
GDK_1EVENT_1WINDOW_FUNC,
29+
GDK_1IS_1WAYLAND_1DISPLAY_FUNC,
2930
GDK_1IS_1X11_1DISPLAY_FUNC,
3031
GDK_1TYPE_1PIXBUF_FUNC,
3132
GDK_1TYPE_1RGBA_FUNC,

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ public class GDK extends OS {
247247
/** @param event cast=(GdkEventAny *) */
248248
public static final native long GDK_EVENT_WINDOW(long event);
249249
/** @param display cast=(GdkDisplay *) */
250+
public static final native boolean GDK_IS_WAYLAND_DISPLAY(long display);
251+
/** @param display cast=(GdkDisplay *) */
250252
public static final native boolean GDK_IS_X11_DISPLAY(long display);
251253
/** @method flags=const */
252254
public static final native long GDK_TYPE_RGBA();

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ public static int VERSION(int major, int minor, int micro) {
706706
}
707707

708708
public static boolean isWayland () {
709-
return !isX11 ();
709+
return OS.GDK_WINDOWING_WAYLAND() && GDK.GDK_IS_WAYLAND_DISPLAY(GDK.gdk_display_get_default());
710710
}
711711

712712
public static boolean isX11 () {

0 commit comments

Comments
 (0)