forge
Explore
Log in

Don't you dare go Hollow

input: do not revert fully invisible cursor to hidden (#1650)

Browse files at this commit

7fdb918cd04076b173a38f026dc5c27ac830b028UnverifiedDuncan Overbruck and Ivan MolodetskikhParent: 8347cc2
* input: do not force redraw to hide an already hidden cursor

* more

---------
src/input/mod.rsmodified+6 -0
@@ -472,6 +472,12 @@ impl State {
472 }472 }
473 473
474 fn hide_cursor_if_needed(&mut self) {474 fn hide_cursor_if_needed(&mut self) {
475+ // If the pointer is already invisible, don't reset it back to Hidden causing one frame
476+ // of hover.
477+ if !self.niri.pointer_visibility.is_visible() {
478+ return;
479+ }
480+
475 if !self.niri.config.borrow().cursor.hide_when_typing {481 if !self.niri.config.borrow().cursor.hide_when_typing {
476 return;482 return;
477 }483 }
src/niri.rsmodified+7 -2
@@ -5986,8 +5986,13 @@ impl Niri {
5986 .event_loop5986 .event_loop
5987 .insert_source(timer, move |_, _, state| {5987 .insert_source(timer, move |_, _, state| {
5988 state.niri.pointer_inactivity_timer = None;5988 state.niri.pointer_inactivity_timer = None;
5989- state.niri.pointer_visibility = PointerVisibility::Hidden;5989+
5990- state.niri.queue_redraw_all();5990+ // If the pointer is already invisible, don't reset it back to Hidden causing one
5991+ // frame of hover.
5992+ if state.niri.pointer_visibility.is_visible() {
5993+ state.niri.pointer_visibility = PointerVisibility::Hidden;
5994+ state.niri.queue_redraw_all();
5995+ }
5991 5996
5992 TimeoutAction::Drop5997 TimeoutAction::Drop
5993 })5998 })