input: do not revert fully invisible cursor to hidden (#1650)
Browse files at this commit2 changed files +13 -2
- src/input/mod.rs +6 -0
- src/niri.rs +7 -2
src/input/mod.rsmodified+6 -0
| @@ -472,6 +472,12 @@ impl State { | ||
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 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 | 481 | if !self.niri.config.borrow().cursor.hide_when_typing { |
| 476 | 482 | return; |
| 477 | 483 | } |
src/niri.rsmodified+7 -2
| @@ -5986,8 +5986,13 @@ impl Niri { | ||
| 5986 | 5986 | .event_loop |
| 5987 | 5987 | .insert_source(timer, move |_, _, state| { |
| 5988 | 5988 | state.niri.pointer_inactivity_timer = None; |
| 5989 | - state.niri.pointer_visibility = PointerVisibility::Hidden; | |
| 5990 | - state.niri.queue_redraw_all(); | |
| 5989 | + | |
| 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 | 5997 | TimeoutAction::Drop |
| 5993 | 5998 | }) |