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

commitff4620009ff684254a592d9a7bc93372301a69d1
parentb54dc76375
authorIsaac Freund <[email protected]>
date2022-04-19 11:10
Cursor: Don't passthrough() on update if hidden

Currently when the surface under the hidden cursor changes, we
passthrough() which results in the cursor being made visible and giving
pointer focus to the surface under the cursor if any. Obviously this is
not desirable as the cursor is supposed to remain hidden until moved.
This added check prevents this.

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

diff --git a/river/Cursor.zig b/river/Cursor.zig
index 04c0ee3..da1b8d6 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -927,6 +927,10 @@ pub fn updateState(self: *Self) void {
 }
 
 fn shouldPassthrough(self: Self) bool {
+    // We clear focus on hiding the cursor and should not re-focus until the cursor is moved
+    // and shown again.
+    if (self.hidden) return false;
+
     switch (self.mode) {
         .passthrough => {
             // If we are not currently in down/resize/move mode, we *always* need to passthrough()