main: throttle refresh

This commit is contained in:
Victoria Brekenfeld 2025-03-05 19:37:12 +01:00 committed by Victoria Brekenfeld
parent 943f97137c
commit 01bc39dade
2 changed files with 50 additions and 7 deletions

View file

@ -119,7 +119,7 @@ use std::{
ffi::OsString,
process::Child,
sync::{atomic::AtomicBool, Arc, Mutex, Once, RwLock},
time::Duration,
time::{Duration, Instant},
};
#[derive(RustEmbed)]
@ -171,11 +171,19 @@ pub fn advertised_node_for_surface(w: &WlSurface, dh: &DisplayHandle) -> Option<
advertised_node_for_client(&client)
}
#[derive(Debug)]
pub enum LastRefresh {
None,
At(Instant),
Scheduled(RegistrationToken),
}
#[derive(Debug)]
pub struct State {
pub backend: BackendData,
pub common: Common,
pub ready: Once,
pub last_refresh: LastRefresh,
}
#[derive(Debug)]
@ -655,6 +663,7 @@ impl State {
},
backend: BackendData::Unset,
ready: Once::new(),
last_refresh: LastRefresh::None,
}
}