Merge pull request #161 from glennw/thread-proxy
Introduce a WindowProxy for accessing a subset of functionality
This commit is contained in:
commit
0164449955
8 changed files with 187 additions and 52 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue