From 39128dd7e11ffa05eb06933cb6e3ce0e750e8806 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 16 Jun 2015 13:48:08 +0200 Subject: Remove the is_closed function --- src/api/win32/init.rs | 1 - src/api/win32/mod.rs | 33 ++------------------------------- 2 files changed, 2 insertions(+), 32 deletions(-) (limited to 'src/api/win32') 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, 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 af339c5..5b0339a 100644 --- a/src/api/win32/mod.rs +++ b/src/api/win32/mod.rs @@ -47,9 +47,6 @@ pub struct Window { /// Receiver for the events dispatched by the window callback. events_receiver: Receiver, - /// True if a `Closed` event has been received. - is_closed: AtomicBool, - /// The current cursor state. cursor_state: Arc>, } @@ -97,12 +94,6 @@ impl Window { init::new_window(builder, sharing) } - /// 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. @@ -366,17 +357,7 @@ impl<'a> Iterator for PollEventsIterator<'a> { type Item = Event; fn next(&mut self) -> Option { - 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() } } @@ -388,17 +369,7 @@ impl<'a> Iterator for WaitEventsIterator<'a> { type Item = Event; fn next(&mut self) -> Option { - 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() } } -- cgit v1.2.3