mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
In control_flow example, don't schedule a new WaitUntil if wait was cancelled (#1482)
This commit is contained in:
parent
ece2e70a53
commit
b8326f6452
|
@ -100,7 +100,13 @@ fn main() {
|
||||||
Event::RedrawEventsCleared => {
|
Event::RedrawEventsCleared => {
|
||||||
*control_flow = match mode {
|
*control_flow = match mode {
|
||||||
Mode::Wait => ControlFlow::Wait,
|
Mode::Wait => ControlFlow::Wait,
|
||||||
Mode::WaitUntil => ControlFlow::WaitUntil(time::Instant::now() + WAIT_TIME),
|
Mode::WaitUntil => {
|
||||||
|
if wait_cancelled {
|
||||||
|
*control_flow
|
||||||
|
} else {
|
||||||
|
ControlFlow::WaitUntil(time::Instant::now() + WAIT_TIME)
|
||||||
|
}
|
||||||
|
}
|
||||||
Mode::Poll => {
|
Mode::Poll => {
|
||||||
thread::sleep(POLL_SLEEP_TIME);
|
thread::sleep(POLL_SLEEP_TIME);
|
||||||
ControlFlow::Poll
|
ControlFlow::Poll
|
||||||
|
|
Loading…
Reference in a new issue