aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Partouche <david@manateedev.com>2014-10-11 22:37:31 +0200
committerDavid Partouche <david@manateedev.com>2014-10-23 17:30:16 +0200
commitba8f55547f18e7fa01d29d945b961476ea1658e0 (patch)
tree7dd4c089dd8f2a6b24ff0984663668b56c06fd17
parent421beefe67754eef3f308b7558c0c569be9ca76b (diff)
downloadglutin-ba8f55547f18e7fa01d29d945b961476ea1658e0.tar.gz
glutin-ba8f55547f18e7fa01d29d945b961476ea1658e0.zip
Added is_closed to osx window
-rw-r--r--src/osx/mod.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/osx/mod.rs b/src/osx/mod.rs
index 5538fb7..d194c21 100644
--- a/src/osx/mod.rs
+++ b/src/osx/mod.rs
@@ -1,4 +1,5 @@
use Event;
+use std::sync::atomics::AtomicBool;
#[cfg(feature = "window")]
use WindowBuilder;
@@ -14,8 +15,10 @@ use core_foundation::string::CFString;
use core_foundation::bundle::{CFBundleGetBundleWithIdentifier, CFBundleGetFunctionPointerForName};
pub struct Window {
+ window: id,
view: id,
context: id,
+ is_closed: AtomicBool,
}
pub struct HeadlessContext(Window);
@@ -87,8 +90,10 @@ impl Window {
}
let window = Window {
+ window: window,
view: view,
context: context,
+ is_closed: AtomicBool::new(false),
};
Ok(window)
@@ -172,8 +177,8 @@ impl Window {
}
pub fn is_closed(&self) -> bool {
- // TODO: remove fake implementation
- false
+ use std::sync::atomics::Relaxed;
+ self.is_closed.load(Relaxed)
}
pub fn set_title(&self, _title: &str) {
@@ -212,6 +217,7 @@ impl Window {
NSDefaultRunLoopMode,
true);
if event == nil { break; }
+ NSApp().sendEvent_(event);
match event.get_type() {
NSLeftMouseDown => { events.push(MouseInput(Pressed, LeftMouseButton)); },
@@ -244,6 +250,7 @@ impl Window {
NSDate::distantFuture(nil),
NSDefaultRunLoopMode,
false);
+ NSApp().sendEvent_(event);
self.poll_events()
}