From 9193245871bf16e0e5b513806dc988caee994c13 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 3 Nov 2024 09:32:58 +0300 Subject: Correct pointer constraint activation logic Internally it uses the pointer focus, so make sure we have up-to-date focus before setting it. --- src/input/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/input') diff --git a/src/input/mod.rs b/src/input/mod.rs index 24d72bc0..888631e2 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -1448,9 +1448,6 @@ impl State { self.niri.handle_focus_follows_mouse(&under); - // Activate a new confinement if necessary. - self.niri.maybe_activate_pointer_constraint(new_pos, &under); - self.niri.pointer_contents.clone_from(&under); pointer.motion( @@ -1475,6 +1472,9 @@ impl State { pointer.frame(self); + // Activate a new confinement if necessary. + self.niri.maybe_activate_pointer_constraint(); + // Redraw to update the cursor position. // FIXME: redraw only outputs overlapping the cursor. self.niri.queue_redraw_all(); @@ -1513,7 +1513,6 @@ impl State { self.niri.handle_focus_follows_mouse(&under); - self.niri.maybe_activate_pointer_constraint(pos, &under); self.niri.pointer_contents.clone_from(&under); pointer.motion( @@ -1528,6 +1527,8 @@ impl State { pointer.frame(self); + self.niri.maybe_activate_pointer_constraint(); + // We moved the pointer, show it. self.niri.pointer_hidden = false; -- cgit