File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -608,21 +608,20 @@ impl<T: Event> ApplicationHandler<T> for WinitAppRunnerState<T> {
608
608
} ) ;
609
609
}
610
610
else {
611
- event_loop. set_control_flow( ControlFlow :: Wait ) ;
611
+ // HACK when showing an overlay, ControlFlow::Wait can be unbounded
612
+ event_loop. set_control_flow( ControlFlow :: WaitUntil ( begin_frame_time + std:: time:: Duration :: from_millis( 25 ) ) ) ;
612
613
}
613
614
}
614
615
615
616
// Trigger the next redraw to refresh the screen immediately if waiting
616
- if let ControlFlow :: Wait = event_loop. control_flow ( ) {
617
+ if ! matches ! ( event_loop. control_flow( ) , ControlFlow :: Poll ) {
617
618
self . redraw_requested = true ;
618
619
}
619
620
}
620
621
UpdateMode :: Reactive { wait, .. } => {
621
622
// Set the next timeout, starting from the instant before running app.update() to avoid frame delays
622
- if let Some ( next) = begin_frame_time. checked_add ( wait) {
623
- if self . wait_elapsed {
624
- event_loop. set_control_flow ( ControlFlow :: WaitUntil ( next) ) ;
625
- }
623
+ if self . wait_elapsed {
624
+ event_loop. set_control_flow ( ControlFlow :: WaitUntil ( begin_frame_time + wait) ) ;
626
625
}
627
626
}
628
627
}
You can’t perform that action at this time.
0 commit comments