aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/tty.rs2
-rw-r--r--src/handlers/mod.rs4
-rw-r--r--src/input/mod.rs9
-rw-r--r--src/niri.rs19
4 files changed, 23 insertions, 11 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index 4ea81edc..003413bf 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -478,7 +478,7 @@ impl Tty {
self.refresh_ipc_outputs(niri);
- niri.idle_notifier_state.notify_activity(&niri.seat);
+ niri.notify_activity();
niri.monitors_active = true;
self.set_monitors_active(true);
niri.queue_redraw_all();
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 587d44ea..c23966ed 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -451,9 +451,7 @@ impl SessionLockHandler for State {
fn unlock(&mut self) {
self.niri.unlock();
self.niri.activate_monitors(&mut self.backend);
- self.niri
- .idle_notifier_state
- .notify_activity(&self.niri.seat);
+ self.niri.notify_activity();
}
fn new_surface(&mut self, surface: LockSurface, output: WlOutput) {
diff --git a/src/input/mod.rs b/src/input/mod.rs
index d1ba853b..b38bc0e9 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -97,10 +97,7 @@ impl State {
if self.niri.monitors_active {
// Notify the idle-notifier of activity.
if should_notify_activity(&event) {
- let _span = tracy_client::span!("IdleNotifierState::notify_activity");
- self.niri
- .idle_notifier_state
- .notify_activity(&self.niri.seat);
+ self.niri.notify_activity();
}
} else {
// Power on monitors if they were off.
@@ -109,9 +106,7 @@ impl State {
// Notify the idle-notifier of activity only if we're also powering on the
// monitors.
- self.niri
- .idle_notifier_state
- .notify_activity(&self.niri.seat);
+ self.niri.notify_activity();
}
}
diff --git a/src/niri.rs b/src/niri.rs
index 19ff317c..b013927b 100644
--- a/src/niri.rs
+++ b/src/niri.rs
@@ -334,6 +334,11 @@ pub struct Niri {
/// Used for limiting the reset to once per iteration, so that it's not spammed with high
/// resolution mice.
pub pointer_inactivity_timer_got_reset: bool,
+ /// Whether the (idle notifier) activity was notified this event loop iteration.
+ ///
+ /// Used for limiting the notify to once per iteration, so that it's not spammed with high
+ /// resolution mice.
+ pub notified_activity_this_iteration: bool,
pub tablet_cursor_location: Option<Point<f64, Logical>>,
pub gesture_swipe_3f_cumulative: Option<(f64, f64)>,
pub vertical_wheel_tracker: ScrollTracker,
@@ -627,6 +632,7 @@ impl State {
// Clear the time so it's fetched afresh next iteration.
self.niri.clock.clear();
self.niri.pointer_inactivity_timer_got_reset = false;
+ self.niri.notified_activity_this_iteration = false;
}
fn refresh(&mut self) {
@@ -2146,6 +2152,7 @@ impl Niri {
pointer_hidden: false,
pointer_inactivity_timer: None,
pointer_inactivity_timer_got_reset: false,
+ notified_activity_this_iteration: false,
tablet_cursor_location: None,
gesture_swipe_3f_cumulative: None,
vertical_wheel_tracker: ScrollTracker::new(120),
@@ -5293,6 +5300,18 @@ impl Niri {
self.pointer_inactivity_timer_got_reset = true;
}
+
+ pub fn notify_activity(&mut self) {
+ if self.notified_activity_this_iteration {
+ return;
+ }
+
+ let _span = tracy_client::span!("Niri::notify_activity");
+
+ self.idle_notifier_state.notify_activity(&self.seat);
+
+ self.notified_activity_this_iteration = true;
+ }
}
pub struct NewClient {