aboutsummaryrefslogtreecommitdiffstats
path: root/src/osx/mod.rs
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2014-12-18 20:36:37 +0100
committertomaka <pierre.krieger1708@gmail.com>2014-12-18 20:36:37 +0100
commit0164449955d1b4787fce03f8800e32f19fd04a01 (patch)
tree67da783cd51b2266add4ac7f11918d878f11f019 /src/osx/mod.rs
parent94348113281828a2045efcf24536ab6b1aad837e (diff)
parent95f82927b37e27f1880e9941b316227f6c6baebc (diff)
downloadglutin-0164449955d1b4787fce03f8800e32f19fd04a01.tar.gz
glutin-0164449955d1b4787fce03f8800e32f19fd04a01.zip
Merge pull request #161 from glennw/thread-proxy
Introduce a WindowProxy for accessing a subset of functionality
Diffstat (limited to 'src/osx/mod.rs')
-rw-r--r--src/osx/mod.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/osx/mod.rs b/src/osx/mod.rs
index 7ea6cb4..42a9ea2 100644
--- a/src/osx/mod.rs
+++ b/src/osx/mod.rs
@@ -74,6 +74,32 @@ impl Window {
}
}
+#[cfg(feature = "window")]
+#[deriving(Clone)]
+pub struct WindowProxy;
+
+impl WindowProxy {
+ pub fn wakeup_event_loop(&self) {
+ unsafe {
+ let pool = NSAutoreleasePool::new(nil);
+ let event =
+ NSEvent::otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2(
+ nil,
+ NSApplicationDefined,
+ NSPoint::new(0.0, 0.0),
+ 0,
+ 0.0,
+ 0,
+ ptr::null_mut(),
+ 0,
+ 0,
+ 0);
+ NSApp().postEvent_atStart_(event, true);
+ pool.drain();
+ }
+ }
+}
+
extern fn window_should_close(this: id, _: id) -> id {
unsafe {
let mut stored_value = ptr::null_mut();
@@ -278,6 +304,10 @@ impl Window {
unimplemented!()
}
+ pub fn create_window_proxy(&self) -> WindowProxy {
+ WindowProxy
+ }
+
pub fn poll_events(&self) -> Vec<Event> {
let mut events = Vec::new();