From f371e00716898d2330c22d2f17d9785e918f115e Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 24 Jul 2021 02:30:15 +0200 Subject: [PATCH] cursor: fix logic in Cursor.updateState() The previous commit re-introduced a bug fixed by a3c65713 which caused the pointer enter event not to be sent until moving the pointer when switching tag focus or otherwise manipulating the window manager caused the cursor to end up over a new surface. --- river/Cursor.zig | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/river/Cursor.zig b/river/Cursor.zig index bb94e7a..06fd452 100644 --- a/river/Cursor.zig +++ b/river/Cursor.zig @@ -775,7 +775,7 @@ fn processMotion(self: *Self, device: *wlr.InputDevice, time: u32, delta_x: f64, /// the target view of a cursor operation potentially being moved to a non-visible tag, /// becoming fullscreen, etc. pub fn updateState(self: *Self) void { - if (self.shouldExitMode()) { + if (self.shouldPassthrough()) { self.mode = .passthrough; var now: os.timespec = undefined; os.clock_gettime(os.CLOCK_MONOTONIC, &now) catch @panic("CLOCK_MONOTONIC not supported"); @@ -785,9 +785,14 @@ pub fn updateState(self: *Self) void { } } -fn shouldExitMode(self: Self) bool { +fn shouldPassthrough(self: Self) bool { switch (self.mode) { - .passthrough => return false, + .passthrough => { + // If we are not currently in down/resize/move mode, we *always* need to passthrough() + // as what is under the cursor may have changed and we are not locked to a single + // target view. + return true; + }, .down => |target| { // The target view is no longer visible return target.current.tags & target.output.current.tags == 0;