Correct pointer constraint activation logic

Internally it uses the pointer focus, so make sure we have up-to-date
focus before setting it.
This commit is contained in:
Ivan Molodetskikh
2024-11-03 09:32:58 +03:00
parent 7baf10b751
commit 9193245871
3 changed files with 27 additions and 22 deletions
+6 -5
View File
@@ -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(