From da59dfc5b4b6046475c36a377be661fbf3351bd0 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 15 Oct 2023 16:30:52 +0400 Subject: Refresh pointer focus continuously Fixes pointer focus not updating after: - switching workspaces - switching between windows so they move around - client appearing below cursor - client resizing to appear below cursor And all other similar cases. Hopefully this doesn't slow things down too much. Preliminary tracy analysis seems to indicate that it doesn't. --- src/input.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/input.rs') diff --git a/src/input.rs b/src/input.rs index cdb9ce1b..fef72156 100644 --- a/src/input.rs +++ b/src/input.rs @@ -394,6 +394,8 @@ impl State { } let under = self.niri.surface_under_and_global_space(new_pos); + self.niri.pointer_focus = under.clone(); + let under = under.map(|u| u.surface); pointer.motion( self, @@ -435,6 +437,8 @@ impl State { let pointer = self.niri.seat.get_pointer().unwrap(); let under = self.niri.surface_under_and_global_space(pos); + self.niri.pointer_focus = under.clone(); + let under = under.map(|u| u.surface); pointer.motion( self, @@ -534,6 +538,8 @@ impl State { let pointer = self.niri.seat.get_pointer().unwrap(); let under = self.niri.surface_under_and_global_space(pos); + self.niri.pointer_focus = under.clone(); + let under = under.map(|u| u.surface); pointer.motion( self, @@ -621,6 +627,8 @@ impl State { let pointer = self.niri.seat.get_pointer().unwrap(); let under = self.niri.surface_under_and_global_space(pos); + self.niri.pointer_focus = under.clone(); + let under = under.map(|u| u.surface); pointer.motion( self, -- cgit