Skip to content

Commit

Permalink
Fix infinite runtime loop when queue redraws at a specific time
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Feb 2, 2025
1 parent e73d0c6 commit 57b553d
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 40 deletions.
89 changes: 49 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions winit/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 57b553d

Please sign in to comment.