diff options
author | 2023-12-20 08:56:57 +0100 | |
---|---|---|
committer | 2023-12-20 08:56:57 +0100 | |
commit | 50a7852cb857cd110077ffce492bafe9ebe8786c (patch) | |
tree | 365364897a1f97c49102b17aabbe6b5936729acb /winit/src/application.rs | |
parent | e772e5a9e90b5d8ae12a9891cb7b848d81e63239 (diff) | |
download | iced-50a7852cb857cd110077ffce492bafe9ebe8786c.tar.gz iced-50a7852cb857cd110077ffce492bafe9ebe8786c.tar.bz2 iced-50a7852cb857cd110077ffce492bafe9ebe8786c.zip |
Stop polling in event loop on `RedrawRequest::NextFrame`
Diffstat (limited to 'winit/src/application.rs')
-rw-r--r-- | winit/src/application.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index 75be08f1..5ff76060 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -314,7 +314,6 @@ async fn run_instance<A, E, C>( match event { event::Event::NewEvents( event::StartCause::Init - | event::StartCause::Poll | event::StartCause::ResumeTimeReached { .. }, ) if !redraw_pending => { window.request_redraw(); @@ -387,7 +386,11 @@ async fn run_instance<A, E, C>( user_interface::State::Updated { redraw_request: Some(redraw_request), } => match redraw_request { - window::RedrawRequest::NextFrame => ControlFlow::Poll, + window::RedrawRequest::NextFrame => { + window.request_redraw(); + + ControlFlow::Wait + } window::RedrawRequest::At(at) => { ControlFlow::WaitUntil(at) } @@ -469,7 +472,7 @@ async fn run_instance<A, E, C>( _ => {} } - if !redraw_pending && events.is_empty() && messages.is_empty() { + if events.is_empty() && messages.is_empty() { continue; } |