diff mbox series

[meta-gnome] sushi: guard libsushi's X11 Window field for Wayland-only GTK4

Message ID 20260926161745.3891393-1-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-gnome] sushi: guard libsushi's X11 Window field for Wayland-only GTK4 | expand

Commit Message

Khem Raj Sept. 26, 2026, 4:17 p.m. UTC
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>
---
 ...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
diff mbox series

Patch

diff --git a/meta-gnome/recipes-gnome/sushi/sushi/0001-libsushi-guard-the-X11-Window-field-when-GDK_WINDOW.patch b/meta-gnome/recipes-gnome/sushi/sushi/0001-libsushi-guard-the-X11-Window-field-when-GDK_WINDOW.patch
new file mode 100644
index 0000000000..f93734800d
--- /dev/null
+++ b/meta-gnome/recipes-gnome/sushi/sushi/0001-libsushi-guard-the-X11-Window-field-when-GDK_WINDOW.patch
@@ -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
diff --git a/meta-gnome/recipes-gnome/sushi/sushi_51.1.bb b/meta-gnome/recipes-gnome/sushi/sushi_51.1.bb
index 8af34b2f26..c1584554b5 100644
--- a/meta-gnome/recipes-gnome/sushi/sushi_51.1.bb
+++ b/meta-gnome/recipes-gnome/sushi/sushi_51.1.bb
@@ -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/"