Merge pull request #488 from tomaka/rem-is-closed

Remove the is_closed function
This commit is contained in:
tomaka 2015-06-17 07:36:16 +02:00
commit 7773996d7b
17 changed files with 72 additions and 176 deletions

View file

@ -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,
})
}

View file

@ -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>>,
}
@ -98,12 +95,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.
@ -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()
}
}