From 052ecdbe2ae5d13e32a6a11ed5d6f5cdf5531674 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 15 Oct 2023 18:58:36 +0400 Subject: Check for ongoing animations earlier Removes the inconsistency that when animating towards an empty pointer position, the focus change would not wait until the end of the animation. --- src/niri.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/niri.rs b/src/niri.rs index 9f6e6da6..29bfc905 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -275,6 +275,14 @@ impl State { let pointer = &self.niri.seat.get_pointer().unwrap(); let location = pointer.current_location(); + // Don't refresh cursor focus during animations. + if let Some((output, _)) = self.niri.output_under(location) { + let monitor = self.niri.layout.monitor_for_output(output).unwrap(); + if monitor.are_animations_ongoing() { + return; + } + } + let under = self.niri.surface_under_and_global_space(location); // We're not changing the global cursor location here, so if the focus did not change, then @@ -283,14 +291,6 @@ impl State { return; } - // Don't refresh cursor focus during animations. - if let Some(PointerFocus { output, .. }) = &under { - let monitor = self.niri.layout.monitor_for_output(output).unwrap(); - if monitor.are_animations_ongoing() { - return; - } - } - self.niri.pointer_focus = under.clone(); let under = under.map(|u| u.surface); -- cgit