diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-11-03 09:32:58 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-11-03 10:15:19 +0300 |
| commit | 9193245871bf16e0e5b513806dc988caee994c13 (patch) | |
| tree | 62db8cce1b02016c6630900cf9428423ef28d75e /src/handlers | |
| parent | 7baf10b751697de0d17a4bac003e5f5207900bf2 (diff) | |
| download | niri-9193245871bf16e0e5b513806dc988caee994c13.tar.gz niri-9193245871bf16e0e5b513806dc988caee994c13.tar.bz2 niri-9193245871bf16e0e5b513806dc988caee994c13.zip | |
Correct pointer constraint activation logic
Internally it uses the pointer focus, so make sure we have up-to-date
focus before setting it.
Diffstat (limited to 'src/handlers')
| -rw-r--r-- | src/handlers/mod.rs | 11 |
1 files changed, 6 insertions, 5 deletions
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>) { - self.niri.maybe_activate_pointer_constraint( - pointer.current_location(), - &self.niri.pointer_contents, - ); + fn new_constraint(&mut self, _surface: &WlSurface, _pointer: &PointerHandle<Self>) { + // 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( |
