Merge pull request #488 from tomaka/rem-is-closed
Remove the is_closed function
This commit is contained in:
commit
7773996d7b
17 changed files with 72 additions and 176 deletions
|
|
@ -130,10 +130,6 @@ impl Window {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn is_closed(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn set_title(&self, title: &str) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ static mut win_pressed: bool = false;
|
|||
static mut alt_pressed: bool = false;
|
||||
|
||||
struct DelegateState {
|
||||
is_closed: bool,
|
||||
context: IdRef,
|
||||
view: IdRef,
|
||||
window: IdRef,
|
||||
|
|
@ -84,8 +83,6 @@ impl WindowDelegate {
|
|||
unsafe {
|
||||
let state: *mut libc::c_void = *this.get_ivar("glutinState");
|
||||
let state = state as *mut DelegateState;
|
||||
(*state).is_closed = true;
|
||||
|
||||
(*state).pending_events.lock().unwrap().push_back(Closed);
|
||||
}
|
||||
YES
|
||||
|
|
@ -382,7 +379,6 @@ impl Window {
|
|||
}
|
||||
|
||||
let ds = DelegateState {
|
||||
is_closed: false,
|
||||
context: context.clone(),
|
||||
view: view.clone(),
|
||||
window: window.clone(),
|
||||
|
|
@ -604,10 +600,6 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_closed(&self) -> bool {
|
||||
self.delegate.state.is_closed
|
||||
}
|
||||
|
||||
pub fn set_title(&self, title: &str) {
|
||||
unsafe {
|
||||
let title = IdRef::new(NSString::alloc(nil).init_str(title));
|
||||
|
|
|
|||
|
|
@ -109,11 +109,6 @@ impl Window {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn is_closed(&self) -> bool {
|
||||
use std::ptr;
|
||||
unsafe { ffi::emscripten_is_webgl_context_lost(ptr::null()) != 0 }
|
||||
}
|
||||
|
||||
pub fn set_title(&self, _title: &str) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -185,11 +185,6 @@ impl Window {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn is_closed(&self) -> bool {
|
||||
// TODO
|
||||
false
|
||||
}
|
||||
|
||||
pub fn set_title(&self, title: &str) {
|
||||
let ctitle = CString::new(title).unwrap();
|
||||
self.shell_surface.set_title(&ctitle);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -264,9 +264,10 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
|
|||
type Item = Event;
|
||||
|
||||
fn next(&mut self) -> Option<Event> {
|
||||
use std::sync::atomic::Ordering::Relaxed;
|
||||
use std::mem;
|
||||
|
||||
while !self.window.is_closed() {
|
||||
while !self.window.is_closed.load(Relaxed) {
|
||||
if let Some(ev) = self.window.pending_events.lock().unwrap().pop_front() {
|
||||
return Some(ev);
|
||||
}
|
||||
|
|
@ -597,11 +598,6 @@ impl Window {
|
|||
Ok(window)
|
||||
}
|
||||
|
||||
pub fn is_closed(&self) -> bool {
|
||||
use std::sync::atomic::Ordering::Relaxed;
|
||||
self.is_closed.load(Relaxed)
|
||||
}
|
||||
|
||||
pub fn set_title(&self, title: &str) {
|
||||
with_c_str(title, |title| unsafe {
|
||||
(self.x.display.xlib.XStoreName)(self.x.display.display, self.x.window, title);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue