diff options
Diffstat (limited to 'src/api/win32')
-rw-r--r-- | src/api/win32/init.rs | 1 | ||||
-rw-r--r-- | src/api/win32/mod.rs | 33 |
2 files changed, 2 insertions, 32 deletions
diff --git a/src/api/win32/init.rs b/src/api/win32/init.rs index f46c395..7cb5433 100644 --- a/src/api/win32/init.rs +++ b/src/api/win32/init.rs @@ -257,7 +257,6 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>, window: real_window, context: context, events_receiver: events_receiver, - is_closed: AtomicBool::new(false), cursor_state: cursor_state, }) } diff --git a/src/api/win32/mod.rs b/src/api/win32/mod.rs index 9efdc93..d21f16d 100644 --- a/src/api/win32/mod.rs +++ b/src/api/win32/mod.rs @@ -48,9 +48,6 @@ pub struct Window { /// Receiver for the events dispatched by the window callback. events_receiver: Receiver<Event>, - /// True if a `Closed` event has been received. - is_closed: AtomicBool, - /// The current cursor state. cursor_state: Arc<Mutex<CursorState>>, } @@ -99,12 +96,6 @@ impl Window { } /// See the docs in the crate root file. - pub fn is_closed(&self) -> bool { - use std::sync::atomic::Ordering::Relaxed; - self.is_closed.load(Relaxed) - } - - /// See the docs in the crate root file. /// /// Calls SetWindowText on the HWND. pub fn set_title(&self, text: &str) { @@ -367,17 +358,7 @@ impl<'a> Iterator for PollEventsIterator<'a> { type Item = Event; fn next(&mut self) -> Option<Event> { - use events::Event::Closed; - - match self.window.events_receiver.try_recv() { - Ok(Closed) => { - use std::sync::atomic::Ordering::Relaxed; - self.window.is_closed.store(true, Relaxed); - Some(Closed) - }, - Ok(ev) => Some(ev), - Err(_) => None - } + self.window.events_receiver.try_recv().ok() } } @@ -389,17 +370,7 @@ impl<'a> Iterator for WaitEventsIterator<'a> { type Item = Event; fn next(&mut self) -> Option<Event> { - use events::Event::Closed; - - match self.window.events_receiver.recv() { - Ok(Closed) => { - use std::sync::atomic::Ordering::Relaxed; - self.window.is_closed.store(true, Relaxed); - Some(Closed) - }, - Ok(ev) => Some(ev), - Err(_) => None - } + self.window.events_receiver.recv().ok() } } |