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

commit1a3a556a3c30263404022d2a7395f0b709639a70
parentb77287c1fb
authorIsaac Freund <[email protected]>
date2026-01-15 12:07
XwaylandWindow: set dimensions hint

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

diff --git a/river/XwaylandWindow.zig b/river/XwaylandWindow.zig
index b371296..6b1c738 100644
--- a/river/XwaylandWindow.zig
+++ b/river/XwaylandWindow.zig
@@ -181,6 +181,19 @@ pub fn handleMap(listener: *wl.Listener(void)) void {
     };
     surface.data = &window.tree.node;
 
+    // TODO(wlroots) update the dimensions_hint if the size hints change
+    // https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5238
+    if (xwindow.xsurface.size_hints) |size_hints| {
+        const min_width: u31 = @max(0, size_hints.min_width);
+        const min_height: u31 = @max(0, size_hints.min_height);
+        window.setDimensionsHint(.{
+            .min_width = min_width,
+            .max_width = @max(min_width, size_hints.max_width),
+            .min_height = min_height,
+            .max_height = @max(min_height, size_hints.max_height),
+        });
+    }
+
     window.state = .initialized;
     window.map() catch {
         log.err("out of memory", .{});