summaryrefslogtreecommitdiffstats
path: root/winit
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-02 02:28:04 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-02 02:28:04 +0100
commit57b553de2f0f2974bf20dfef2bd71b0a466e00e2 (patch)
treed35a73189bee7b636c10c2f8f779ee5ef7d9edec /winit
parente73d0c65d249026af40518847ac4c505ea3b1383 (diff)
downloadiced-57b553de2f0f2974bf20dfef2bd71b0a466e00e2.tar.gz
iced-57b553de2f0f2974bf20dfef2bd71b0a466e00e2.tar.bz2
iced-57b553de2f0f2974bf20dfef2bd71b0a466e00e2.zip
Fix infinite runtime loop when queue redraws at a specific time
Diffstat (limited to 'winit')
-rw-r--r--winit/src/program.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/winit/src/program.rs b/winit/src/program.rs
index 5387e5e5..d8436212 100644
--- a/winit/src/program.rs
+++ b/winit/src/program.rs
@@ -737,6 +737,17 @@ async fn run_instance<P, C>(
}
}
}
+
+ if let Some(redraw_at) = window_manager.redraw_at() {
+ let _ =
+ control_sender.start_send(Control::ChangeFlow(
+ ControlFlow::WaitUntil(redraw_at),
+ ));
+ } else {
+ let _ = control_sender.start_send(
+ Control::ChangeFlow(ControlFlow::Wait),
+ );
+ }
}
event::Event::PlatformSpecific(
event::PlatformSpecific::MacOS(
@@ -868,6 +879,7 @@ async fn run_instance<P, C>(
match redraw_request {
window::RedrawRequest::NextFrame => {
window.raw.request_redraw();
+ window.redraw_at = None;
}
window::RedrawRequest::At(at) => {
window.redraw_at = Some(at);
@@ -1028,6 +1040,7 @@ async fn run_instance<P, C>(
} => match redraw_request {
window::RedrawRequest::NextFrame => {
window.raw.request_redraw();
+ window.redraw_at = None;
}
window::RedrawRequest::At(at) => {
window.redraw_at = Some(at);