main: throttle refresh
This commit is contained in:
parent
943f97137c
commit
01bc39dade
2 changed files with 50 additions and 7 deletions
11
src/state.rs
11
src/state.rs
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue