Skip to contentSkip to conversation

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

PATCH New Khem Raj 1 participant 1 message Sep 26

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 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

---
 ...the-X11-Window-field-when-GDK_WINDOW.patch | 42 +++++++++++++++++++
 meta-gnome/recipes-gnome/sushi/sushi_51.1.bb  |  2 +
 2 files changed, 44 insertions(+)
 create mode 100644 meta-gnome/recipes-gnome/sushi/sushi/0001-libsushi-guard-the-X11-Window-field-when-GDK_WINDOW.patch
meta-gnome/recipes-gnome/sushi/sushi/0001-libsushi-guard-the-X11-Window-field-when-GDK_WINDOW.patch new file +42 -0
new file mode 100644
index 0000000000..f93734800d
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+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 <[email protected]>
+---
+ 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
meta-gnome/recipes-gnome/sushi/sushi_51.1.bb +2 -0
index 8af34b2f26..c1584554b5 100644
@@ -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/"