Add timeout argument to pump_events
This renames all internal implementations of pump_events_with_timeout to pump_events and makes them public. Since all platforms that support pump_events support timeouts there's no need to have a separate API.
This commit is contained in:
parent
e6c7cc297d
commit
ae9b02e097
9 changed files with 23 additions and 68 deletions
|
|
@ -632,7 +632,7 @@ impl AppState {
|
|||
Self::stop();
|
||||
}
|
||||
HANDLER.update_start_time();
|
||||
let wait_timeout = HANDLER.wait_timeout(); // configured by pump_events_with_timeout
|
||||
let wait_timeout = HANDLER.wait_timeout(); // configured by pump_events
|
||||
let app_timeout = match HANDLER.control_flow() {
|
||||
ControlFlow::Wait => None,
|
||||
ControlFlow::Poll | ControlFlow::ExitWithCode(_) => Some(Instant::now()),
|
||||
|
|
|
|||
|
|
@ -291,14 +291,7 @@ impl<T> EventLoop<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn pump_events<F>(&mut self, callback: F) -> PumpStatus
|
||||
where
|
||||
F: FnMut(Event<'_, T>, &RootWindowTarget<T>, &mut ControlFlow),
|
||||
{
|
||||
self.pump_events_with_timeout(Some(Duration::ZERO), callback)
|
||||
}
|
||||
|
||||
fn pump_events_with_timeout<F>(&mut self, timeout: Option<Duration>, callback: F) -> PumpStatus
|
||||
pub fn pump_events<F>(&mut self, timeout: Option<Duration>, callback: F) -> PumpStatus
|
||||
where
|
||||
F: FnMut(Event<'_, T>, &RootWindowTarget<T>, &mut ControlFlow),
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue