git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit75cba1a8089fce7bd37175419f11c86cbe2f11a1
parent07b2262bbc
authorIsaac Freund <[email protected]>
date2026-02-26 09:26
Xwayland: ensure all state sent for new windows

There have been bug reports of river not sending a
river_window_v1.fullscreen_requested event in some cases when a new
Xwayland window is started in fullscreen mode for example.

 river/XwaylandWindow.zig | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/river/XwaylandWindow.zig b/river/XwaylandWindow.zig
index 1e17698..0870d75 100644
--- a/river/XwaylandWindow.zig
+++ b/river/XwaylandWindow.zig
@@ -75,6 +75,23 @@ pub fn create(xsurface: *wlr.XwaylandSurface) error{OutOfMemory}!void {
     xsurface.events.request_fullscreen.add(&xwindow.request_fullscreen);
     xsurface.events.request_minimize.add(&xwindow.request_minimize);
 
+    // When an override redirect window is converted to a normal Xwayland window
+    // we need to synchronize state which may have changed.
+    if (xwindow.xsurface.decorations.no_border or xwindow.xsurface.decorations.no_title) {
+        xwindow.window.wm_scheduled.decoration_hint = .prefers_csd;
+    } else {
+        xwindow.window.wm_scheduled.decoration_hint = .prefers_ssd;
+    }
+    if (xwindow.xsurface.fullscreen) {
+        xwindow.window.wm_scheduled.fullscreen_requested = .{ .fullscreen = null };
+    }
+    if (xwindow.xsurface.maximized_vert or xwindow.xsurface.maximized_horz) {
+        xwindow.window.wm_scheduled.maximize_requested = .maximize;
+    }
+    if (xwindow.xsurface.minimized) {
+        xwindow.window.wm_scheduled.minimize_requested = true;
+    }
+
     if (xsurface.surface) |surface| {
         handleAssociate(&xwindow.associate);
         if (surface.mapped) {