summaryrefslogtreecommitdiffstats
path: root/winit
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-01-12 05:18:25 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-01-12 05:18:25 +0100
commite2ddef74387bcd81859b56e47316c47d7b739a01 (patch)
tree03864b74535a2abc6fdcfd5d08f3f9539e8b4004 /winit
parent502c9bfbf6eb6193adf6c88abdc4cef90816a04b (diff)
downloadiced-e2ddef74387bcd81859b56e47316c47d7b739a01.tar.gz
iced-e2ddef74387bcd81859b56e47316c47d7b739a01.tar.bz2
iced-e2ddef74387bcd81859b56e47316c47d7b739a01.zip
Replace `Option<Instant>` with `RedrawRequest` enum
Diffstat (limited to 'winit')
-rw-r--r--winit/src/application.rs12
-rw-r--r--winit/src/window.rs2
2 files changed, 11 insertions, 3 deletions
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<A, E, C>(
redraw_pending = matches!(
start_cause,
event::StartCause::Init
+ | event::StartCause::Poll
| event::StartCause::ResumeTimeReached { .. }
);
}
@@ -440,8 +441,15 @@ async fn run_instance<A, E, C>(
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<Message>() -> Command<Message> {