mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
should_close() renamed to is_closed()
This commit is contained in:
parent
1249ebed80
commit
6d9c5eb2bd
|
@ -20,7 +20,7 @@ fn main() {
|
||||||
|
|
||||||
gl::ClearColor(0.0, 1.0, 0.0, 1.0);
|
gl::ClearColor(0.0, 1.0, 0.0, 1.0);
|
||||||
|
|
||||||
while !window.should_close() {
|
while !window.is_closed() {
|
||||||
println!("{}", window.wait_events());
|
println!("{}", window.wait_events());
|
||||||
|
|
||||||
gl::Clear(gl::COLOR_BUFFER_BIT);
|
gl::Clear(gl::COLOR_BUFFER_BIT);
|
||||||
|
|
|
@ -41,8 +41,15 @@ impl Window {
|
||||||
|
|
||||||
/// Returns true if the window has been closed by the user.
|
/// Returns true if the window has been closed by the user.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
pub fn is_closed(&self) -> bool {
|
||||||
|
self.window.is_closed()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns true if the window has been closed by the user.
|
||||||
|
#[inline]
|
||||||
|
#[deprecated = "Use is_closed instead"]
|
||||||
pub fn should_close(&self) -> bool {
|
pub fn should_close(&self) -> bool {
|
||||||
self.window.should_close()
|
self.is_closed()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Modifies the title of the window.
|
/// Modifies the title of the window.
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub struct Window {
|
||||||
context: ffi::HGLRC,
|
context: ffi::HGLRC,
|
||||||
gl_library: ffi::HMODULE,
|
gl_library: ffi::HMODULE,
|
||||||
events_receiver: Receiver<Event>,
|
events_receiver: Receiver<Event>,
|
||||||
should_close: AtomicBool,
|
is_closed: AtomicBool,
|
||||||
nosend: NoSend,
|
nosend: NoSend,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,14 +187,14 @@ impl Window {
|
||||||
context: context,
|
context: context,
|
||||||
gl_library: gl_library,
|
gl_library: gl_library,
|
||||||
events_receiver: events_receiver,
|
events_receiver: events_receiver,
|
||||||
should_close: AtomicBool::new(false),
|
is_closed: AtomicBool::new(false),
|
||||||
nosend: NoSend,
|
nosend: NoSend,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn should_close(&self) -> bool {
|
pub fn is_closed(&self) -> bool {
|
||||||
use std::sync::atomics::Relaxed;
|
use std::sync::atomics::Relaxed;
|
||||||
self.should_close.load(Relaxed)
|
self.is_closed.load(Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calls SetWindowText on the HWND.
|
/// Calls SetWindowText on the HWND.
|
||||||
|
@ -292,7 +292,7 @@ impl Window {
|
||||||
|
|
||||||
if events.iter().find(|e| match e { &&::Closed => true, _ => false }).is_some() {
|
if events.iter().find(|e| match e { &&::Closed => true, _ => false }).is_some() {
|
||||||
use std::sync::atomics::Relaxed;
|
use std::sync::atomics::Relaxed;
|
||||||
self.should_close.store(true, Relaxed);
|
self.is_closed.store(true, Relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
events
|
events
|
||||||
|
|
|
@ -10,7 +10,7 @@ pub struct Window {
|
||||||
display: *mut ffi::Display,
|
display: *mut ffi::Display,
|
||||||
window: ffi::Window,
|
window: ffi::Window,
|
||||||
context: ffi::GLXContext,
|
context: ffi::GLXContext,
|
||||||
should_close: AtomicBool,
|
is_closed: AtomicBool,
|
||||||
wm_delete_window: ffi::Atom,
|
wm_delete_window: ffi::Atom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,14 +103,14 @@ impl Window {
|
||||||
display: display,
|
display: display,
|
||||||
window: window,
|
window: window,
|
||||||
context: context,
|
context: context,
|
||||||
should_close: AtomicBool::new(false),
|
is_closed: AtomicBool::new(false),
|
||||||
wm_delete_window: wm_delete_window,
|
wm_delete_window: wm_delete_window,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn should_close(&self) -> bool {
|
pub fn is_closed(&self) -> bool {
|
||||||
use std::sync::atomics::Relaxed;
|
use std::sync::atomics::Relaxed;
|
||||||
self.should_close.load(Relaxed)
|
self.is_closed.load(Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_title(&self, title: &str) {
|
pub fn set_title(&self, title: &str) {
|
||||||
|
@ -167,7 +167,7 @@ impl Window {
|
||||||
let client_msg: &ffi::XClientMessageEvent = unsafe { mem::transmute(&xev) };
|
let client_msg: &ffi::XClientMessageEvent = unsafe { mem::transmute(&xev) };
|
||||||
|
|
||||||
if client_msg.l[0] == self.wm_delete_window as libc::c_long {
|
if client_msg.l[0] == self.wm_delete_window as libc::c_long {
|
||||||
self.should_close.store(true, Relaxed);
|
self.is_closed.store(true, Relaxed);
|
||||||
events.push(Closed);
|
events.push(Closed);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue