sushi: guard libsushi's X11 Window field for Wayland-only GTK4

ExternalWindow unconditionally declares an Xlib "Window xid" struct
member, but GTK4 only exposes the Window typedef (via gdk/x11/gdkx.h)
when it was itself built with the X11 backend. On a Wayland-only GTK4
build (GDK_WINDOWING_X11 undefined), this fails to compile even though
sushi's own X11 handle parsing still needs an integer member to track
x11: handles received over the window handle protocol.

Fall back to gulong, the same underlying type as Xlib's Window, when
GDK_WINDOWING_X11 is not defined.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj committed 2026-09-26 09:16:40 -07:00
1 parent 97e61e0e6f
commit 8718bb269b
2 files changed
+44

No files matched your search

@@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 25 Sep 2026 00:00:00 +0000
Subject: [PATCH] libsushi: guard the X11 Window field when
GDK_WINDOWING_X11 is unset
ExternalWindow unconditionally declares an Xlib "Window xid" struct
member, but GTK4 only exposes the Window typedef (via gdk/x11/gdkx.h)
when it was itself built with the X11 backend. On a Wayland-only GTK4
build (GDK_WINDOWING_X11 undefined in gdkconfig.h), this field fails
to compile even though sushi's own X11 handle parsing in
create_external_window_from_handle() still needs an integer member to
track x11: handles received over the window handle protocol.
Fall back to gulong, the same underlying type as Xlib's Window, when
GDK_WINDOWING_X11 is not defined.
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/libsushi/externalwindow.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/libsushi/externalwindow.c b/src/libsushi/externalwindow.c
index 1111111..2222222 100644
--- a/src/libsushi/externalwindow.c
+++ b/src/libsushi/externalwindow.c
@@ -38,7 +38,11 @@ struct _ExternalWindow
GdkDisplay *display;
char *wayland_str;
+#ifdef GDK_WINDOWING_X11
Window xid;
+#else
+ gulong xid;
+#endif
};
G_DEFINE_FINAL_TYPE (ExternalWindow, external_window, G_TYPE_OBJECT)
--
2.43.0
@@ -28,6 +28,8 @@ GIR_MESON_OPTION = ""
REQUIRED_DISTRO_FEATURES = "opengl gobject-introspection-data"
SRC_URI += "file://0001-libsushi-guard-the-X11-Window-field-when-GDK_WINDOW.patch"
SRC_URI[archive.sha256sum] = "d326ec69fc004be3a5fc048f7ecf2c8eb828b7d8b682f1e7a2ba01a5e72993e1"
export GI_TYPELIB_PATH = "${STAGING_LIBDIR}/girepository-1.0/"