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/handlers/mod.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/handlers') diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index a60de97f..f3f5cb82 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -137,11 +137,12 @@ impl TabletSeatHandler for State { delegate_tablet_manager!(State); impl PointerConstraintsHandler for State { - fn new_constraint(&mut self, _surface: &WlSurface, pointer: &PointerHandle) { - self.niri.maybe_activate_pointer_constraint( - pointer.current_location(), - &self.niri.pointer_contents, - ); + fn new_constraint(&mut self, _surface: &WlSurface, _pointer: &PointerHandle) { + // Pointer constraints track pointer focus internally, so make sure it's up to date before + // activating a new one. + self.refresh_pointer_contents(); + + self.niri.maybe_activate_pointer_constraint(); } fn cursor_position_hint( -- cgit