aboutsummaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-10-06 20:27:04 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-10-06 22:09:19 -0700
commit6fb60dacd2f6743b13ee955234f025015dbe5f87 (patch)
tree4b214e1e6a7fe62be9592ef0c142e59acc24c1b9 /src/input
parent42a9daec9db57e16541b6ef236b695b71bfb1199 (diff)
downloadniri-6fb60dacd2f6743b13ee955234f025015dbe5f87.tar.gz
niri-6fb60dacd2f6743b13ee955234f025015dbe5f87.tar.bz2
niri-6fb60dacd2f6743b13ee955234f025015dbe5f87.zip
Rework pointer inactivity hide as a timer
The previous way was prone to triggering late due to compositor idling and therefore never calling the check function.
Diffstat (limited to 'src/input')
-rw-r--r--src/input/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs
index 440fcb36..7c43c896 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -2,7 +2,7 @@ use std::any::Any;
use std::cmp::min;
use std::collections::hash_map::Entry;
use std::collections::HashSet;
-use std::time::{Duration, Instant};
+use std::time::Duration;
use calloop::timer::{TimeoutAction, Timer};
use input::event::gesture::GestureEventCoordinates as _;
@@ -87,8 +87,8 @@ impl State {
}
}
- if should_update_cursor_timeout(&event) {
- self.niri.last_cursor_movement = Instant::now();
+ if should_reset_pointer_inactivity_timer(&event) {
+ self.niri.reset_pointer_inactivity_timer();
}
let hide_hotkey_overlay =
@@ -2561,7 +2561,7 @@ fn should_notify_activity<I: InputBackend>(event: &InputEvent<I>) -> bool {
)
}
-fn should_update_cursor_timeout<I: InputBackend>(event: &InputEvent<I>) -> bool {
+fn should_reset_pointer_inactivity_timer<I: InputBackend>(event: &InputEvent<I>) -> bool {
matches!(
event,
InputEvent::PointerAxis { .. }