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> {
608608 } ) ;
609609 }
610610 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 ) ) ) ;
612613 }
613614 }
614615
615616 // 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 ) {
617618 self . redraw_requested = true ;
618619 }
619620 }
620621 UpdateMode :: Reactive { wait, .. } => {
621622 // 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) ) ;
626625 }
627626 }
628627 }
You can’t perform that action at this time.
0 commit comments