Move ControlFlow to EventLoopWindowTarget

Fixes #3042.
This commit is contained in:
daxpedda 2023-09-07 08:25:04 +02:00 committed by GitHub
parent 8fdd81ecef
commit e648169861
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 800 additions and 860 deletions

View file

@ -10,7 +10,7 @@ mod example {
use std::rc::Rc;
use winit::event::{ElementState, Event, KeyEvent, WindowEvent};
use winit::event_loop::EventLoop;
use winit::event_loop::{ControlFlow, EventLoop};
use winit::keyboard::Key;
use winit::platform::startup_notify::{
EventLoopExtStartupNotify, WindowBuilderExtStartupNotify, WindowExtStartupNotify,
@ -32,7 +32,7 @@ mod example {
let mut counter = 0;
let mut create_first_window = false;
event_loop.run(move |event, elwt, flow| {
event_loop.run(move |event, elwt| {
match event {
Event::Resumed => create_first_window = true,
@ -61,7 +61,7 @@ mod example {
// Remove the window from the map.
windows.remove(&window_id);
if windows.is_empty() {
flow.set_exit();
elwt.exit();
return;
}
}
@ -103,7 +103,7 @@ mod example {
create_first_window = false;
}
flow.set_wait();
elwt.set_control_flow(ControlFlow::Wait);
})
}
}