From e2ddef74387bcd81859b56e47316c47d7b739a01 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 12 Jan 2023 05:18:25 +0100 Subject: Replace `Option` with `RedrawRequest` enum --- winit/src/application.rs | 12 ++++++++++-- winit/src/window.rs | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'winit') diff --git a/winit/src/application.rs b/winit/src/application.rs index 0f5309d2..b6485cb7 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -332,6 +332,7 @@ async fn run_instance( redraw_pending = matches!( start_cause, event::StartCause::Init + | event::StartCause::Poll | event::StartCause::ResumeTimeReached { .. } ); } @@ -440,8 +441,15 @@ async fn run_instance( let _ = control_sender.start_send(match interface_state { user_interface::State::Updated { - redraw_requested_at: Some(at), - } => ControlFlow::WaitUntil(at), + redraw_request: Some(redraw_request), + } => match redraw_request { + crate::window::RedrawRequest::NextFrame => { + ControlFlow::Poll + } + crate::window::RedrawRequest::At(at) => { + ControlFlow::WaitUntil(at) + } + }, _ => ControlFlow::Wait, }); diff --git a/winit/src/window.rs b/winit/src/window.rs index 0b9e4c46..2306bdf1 100644 --- a/winit/src/window.rs +++ b/winit/src/window.rs @@ -2,7 +2,7 @@ use crate::command::{self, Command}; use iced_native::window; -pub use window::{frames, Event, Mode, UserAttention}; +pub use window::{frames, Event, Mode, RedrawRequest, UserAttention}; /// Closes the current window and exits the application. pub fn close() -> Command { -- cgit