forge
Explore
Log in

Don't you dare go Hollow

Account for hidden pointer in move_cursor()

Browse files at this commit

a605a3f016769ba2fd7e2147fe05c9ac3707f973Ivan MolodetskikhParent: ef44ade
src/niri.rsmodified+15 -1
@@ -740,7 +740,21 @@ impl State {
740 }740 }
741 741
742 pub fn move_cursor(&mut self, location: Point<f64, Logical>) {742 pub fn move_cursor(&mut self, location: Point<f64, Logical>) {
743- let under = self.niri.contents_under(location);743+ let mut under = match self.niri.pointer_visibility {
744+ PointerVisibility::Disabled => PointContents::default(),
745+ _ => self.niri.contents_under(location),
746+ };
747+
748+ // Disable the hidden pointer if the contents underneath have changed.
749+ if !self.niri.pointer_visibility.is_visible() && self.niri.pointer_contents != under {
750+ self.niri.pointer_visibility = PointerVisibility::Disabled;
751+
752+ // When setting PointerVisibility::Hidden together with pointer contents changing,
753+ // we can change straight to nothing to avoid one frame of hover. Notably, this can
754+ // be triggered through warp-mouse-to-focus combined with hide-when-typing.
755+ under = PointContents::default();
756+ }
757+
744 self.niri.pointer_contents.clone_from(&under);758 self.niri.pointer_contents.clone_from(&under);
745 759
746 let pointer = &self.niri.seat.get_pointer().unwrap();760 let pointer = &self.niri.seat.get_pointer().unwrap();