mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 13:51:30 +11:00
Rename ControlFlow variant from Complete to Break
This commit is contained in:
parent
df1276d72a
commit
04ccad1dbc
|
@ -23,7 +23,7 @@ fn main() {
|
|||
}
|
||||
},
|
||||
Event::WindowEvent { event: WindowEvent::Closed, .. } => {
|
||||
return ControlFlow::Complete;
|
||||
return ControlFlow::Break;
|
||||
},
|
||||
_ => ()
|
||||
}
|
||||
|
|
|
@ -37,10 +37,10 @@ fn main() {
|
|||
match event {
|
||||
Event::WindowEvent { event, .. } => {
|
||||
match event {
|
||||
WindowEvent::Closed => return ControlFlow::Complete,
|
||||
WindowEvent::Closed => return ControlFlow::Break,
|
||||
WindowEvent::KeyboardInput {
|
||||
input: winit::KeyboardInput { virtual_keycode: Some(winit::VirtualKeyCode::Escape), .. }, ..
|
||||
} => return ControlFlow::Complete,
|
||||
} => return ControlFlow::Break,
|
||||
_ => ()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -28,7 +28,7 @@ fn main() {
|
|||
}
|
||||
},
|
||||
|
||||
WindowEvent::Closed => return ControlFlow::Complete,
|
||||
WindowEvent::Closed => return ControlFlow::Break,
|
||||
|
||||
a @ WindowEvent::MouseMoved { .. } => {
|
||||
println!("{:?}", a);
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() {
|
|||
println!("{:?}", event);
|
||||
|
||||
match event {
|
||||
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => winit::ControlFlow::Complete,
|
||||
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => winit::ControlFlow::Break,
|
||||
_ => winit::ControlFlow::Continue,
|
||||
}
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ fn main() {
|
|||
|
||||
num_windows -= 1;
|
||||
if num_windows == 0 {
|
||||
return winit::ControlFlow::Complete;
|
||||
return winit::ControlFlow::Break;
|
||||
}
|
||||
},
|
||||
_ => (),
|
||||
|
|
|
@ -22,7 +22,7 @@ fn main() {
|
|||
println!("{:?}", event);
|
||||
match event {
|
||||
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } =>
|
||||
winit::ControlFlow::Complete,
|
||||
winit::ControlFlow::Break,
|
||||
_ => winit::ControlFlow::Continue,
|
||||
}
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() {
|
|||
println!("{:?}", event);
|
||||
|
||||
match event {
|
||||
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => winit::ControlFlow::Complete,
|
||||
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => winit::ControlFlow::Break,
|
||||
_ => winit::ControlFlow::Continue,
|
||||
}
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() {
|
|||
|
||||
match event {
|
||||
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => {
|
||||
winit::ControlFlow::Complete
|
||||
winit::ControlFlow::Break
|
||||
},
|
||||
_ => winit::ControlFlow::Continue,
|
||||
}
|
||||
|
|
|
@ -52,11 +52,11 @@ macro_rules! gen_api_transition {
|
|||
loop {
|
||||
let mut control_flow = ::ControlFlow::Continue;
|
||||
self.poll_events(|e| {
|
||||
if let ::ControlFlow::Complete = callback(e) {
|
||||
control_flow = ::ControlFlow::Complete;
|
||||
if let ::ControlFlow::Break = callback(e) {
|
||||
control_flow = ::ControlFlow::Break;
|
||||
}
|
||||
});
|
||||
if let ::ControlFlow::Complete = control_flow {
|
||||
if let ::ControlFlow::Break = control_flow {
|
||||
break;
|
||||
}
|
||||
::std::thread::sleep(::std::time::Duration::from_millis(5));
|
||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -51,7 +51,7 @@
|
|||
//! ```
|
||||
//!
|
||||
//! The second way is to call `events_loop.run_forever(...)`. As its name tells, it will run
|
||||
//! forever unless it is stopped by returning `ControlFlow::Complete`.
|
||||
//! forever unless it is stopped by returning `ControlFlow::Break`.
|
||||
//!
|
||||
//! ```no_run
|
||||
//! use winit::{ControlFlow, Event, WindowEvent};
|
||||
|
@ -62,7 +62,7 @@
|
|||
//! match event {
|
||||
//! Event::WindowEvent { event: WindowEvent::Closed, .. } => {
|
||||
//! println!("The window was closed ; stopping");
|
||||
//! ControlFlow::Complete
|
||||
//! ControlFlow::Break
|
||||
//! },
|
||||
//! _ => ControlFlow::Continue,
|
||||
//! }
|
||||
|
@ -143,7 +143,7 @@ pub mod os;
|
|||
/// events_loop.run_forever(|event| {
|
||||
/// match event {
|
||||
/// Event::WindowEvent { event: WindowEvent::Closed, .. } => {
|
||||
/// ControlFlow::Complete
|
||||
/// ControlFlow::Break
|
||||
/// },
|
||||
/// _ => ControlFlow::Continue,
|
||||
/// }
|
||||
|
@ -192,8 +192,8 @@ pub struct EventsLoop {
|
|||
pub enum ControlFlow {
|
||||
/// Continue looping and waiting for events.
|
||||
Continue,
|
||||
/// Exit from the event loop.
|
||||
Complete,
|
||||
/// Break from the event loop.
|
||||
Break,
|
||||
}
|
||||
|
||||
impl EventsLoop {
|
||||
|
|
|
@ -226,8 +226,8 @@ impl EventsLoop {
|
|||
|
||||
// Check for control flow by wrapping the callback.
|
||||
let control_flow = ::std::cell::Cell::new(ControlFlow::Continue);
|
||||
let callback = |event| if let ControlFlow::Complete = callback(event) {
|
||||
control_flow.set(ControlFlow::Complete);
|
||||
let callback = |event| if let ControlFlow::Break = callback(event) {
|
||||
control_flow.set(ControlFlow::Break);
|
||||
};
|
||||
|
||||
// set the callback into the sink
|
||||
|
@ -251,7 +251,7 @@ impl EventsLoop {
|
|||
self.prune_dead_windows()
|
||||
}
|
||||
|
||||
if let ControlFlow::Complete = control_flow.get() {
|
||||
if let ControlFlow::Break = control_flow.get() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,18 +163,18 @@ impl EventsLoop {
|
|||
|
||||
let mut control_flow = ControlFlow::Continue;
|
||||
|
||||
// Track whether or not `Complete` was returned when processing the event.
|
||||
// Track whether or not `Break` was returned when processing the event.
|
||||
{
|
||||
let mut cb = |event| {
|
||||
if let ControlFlow::Complete = callback(event) {
|
||||
control_flow = ControlFlow::Complete;
|
||||
if let ControlFlow::Break = callback(event) {
|
||||
control_flow = ControlFlow::Break;
|
||||
}
|
||||
};
|
||||
|
||||
self.process_event(&mut xev, &mut cb);
|
||||
}
|
||||
|
||||
if let ControlFlow::Complete = control_flow {
|
||||
if let ControlFlow::Break = control_flow {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,8 +222,8 @@ impl EventsLoop {
|
|||
let control_flow = std::cell::Cell::new(ControlFlow::Continue);
|
||||
|
||||
let mut callback = |event| {
|
||||
if let ControlFlow::Complete = callback(event) {
|
||||
control_flow.set(ControlFlow::Complete);
|
||||
if let ControlFlow::Break = callback(event) {
|
||||
control_flow.set(ControlFlow::Break);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -233,7 +233,7 @@ impl EventsLoop {
|
|||
unsafe {
|
||||
// First, yield all pending events.
|
||||
self.shared.call_user_callback_with_pending_events();
|
||||
if let ControlFlow::Complete = control_flow.get() {
|
||||
if let ControlFlow::Break = control_flow.get() {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ impl EventsLoop {
|
|||
|
||||
if let Some(event) = maybe_event {
|
||||
self.shared.user_callback.call_with_event(event);
|
||||
if let ControlFlow::Complete = control_flow.get() {
|
||||
if let ControlFlow::Break = control_flow.get() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue