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

commit14c97cc2454b5139f63579b6136677c0502300c7
parent053ff03410
authorLordMZTE <[email protected]>
date2024-05-01 15:25
Xwayland: disallow negative output coordinates

Xwayland clients on outputs at negative positions don't currently
receive mouse events due to a bug in Xwayland. As a workaround, we
disallow negative output positions when Xwayland is enabled.

References: https://gitlab.freedesktop.org/xorg/xserver/-/issues/899
Closes: #1058

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

diff --git a/river/Root.zig b/river/Root.zig
index 258129d..6d2dd8f 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -814,6 +814,19 @@ fn processOutputConfig(
         var proposed_state = wlr.Output.State.init();
         head.state.apply(&proposed_state);
 
+        // Negative output coordinates currently cause Xwayland clients to not receive click events.
+        // See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/899
+        if (build_options.xwayland and server.xwayland != null and
+            (head.state.x < 0 or head.state.y < 0))
+        {
+            std.log.scoped(.output_manager).err(
+                \\Attempted to set negative coordinates for output {s}.
+                \\Negative output coordinates are disallowed if Xwayland is enabled due to a limitation of Xwayland.
+            , .{output.wlr_output.name});
+            success = false;
+            continue;
+        }
+
         switch (action) {
             .test_only => {
                 if (!wlr_output.testState(&proposed_state)) success = false;