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

commit825f1c569e6dd05aaf88320dca1aaa4f76c4a250
parent14c97cc245
authorIsaac Freund <[email protected]>
date2024-05-12 10:42
Cursor: don't hide while pointer constraint active

Fixes: https://codeberg.org/river/river/issues/1053

 river/Cursor.zig | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/river/Cursor.zig b/river/Cursor.zig
index 3b4e0a3..29e7ed9 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -769,6 +769,14 @@ fn handleRequestSetCursor(
 
 pub fn hide(cursor: *Cursor) void {
     if (cursor.pressed_count > 0) return;
+
+    // Hiding the cursor and sending wl_pointer.leave whlie a pointer constraint
+    // is active does not make much sense. In particular, doing so seems to interact
+    // poorly with Xwayland's pointer constraints implementation.
+    if (cursor.constraint) |constraint| {
+        if (constraint.state == .active) return;
+    }
+
     cursor.hidden = true;
     cursor.wlr_cursor.unsetImage();
     cursor.xcursor_name = null;