aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimir@pobox.com>2015-09-22 14:02:36 -0400
committerVladimir Vukicevic <vladimir@pobox.com>2015-09-22 14:23:53 -0400
commit059821a99c6227e3b5ea271dc31c561a7a65d95b (patch)
tree5a33a06697676cf1ea1ef5b4b48cbb087b436bcf /src
parent4af72a4109fe825af4594f5585c554cfd3528157 (diff)
downloadglutin-059821a99c6227e3b5ea271dc31c561a7a65d95b.tar.gz
glutin-059821a99c6227e3b5ea271dc31c561a7a65d95b.zip
win32: implement wakeup_event_loop
Diffstat (limited to 'src')
-rw-r--r--src/api/win32/callback.rs6
-rw-r--r--src/api/win32/mod.rs14
2 files changed, 17 insertions, 3 deletions
diff --git a/src/api/win32/callback.rs b/src/api/win32/callback.rs
index da8e1a6..45de907 100644
--- a/src/api/win32/callback.rs
+++ b/src/api/win32/callback.rs
@@ -281,6 +281,12 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
0
},
+ x if x == *super::WAKEUP_MSG_ID => {
+ use events::Event::Awakened;
+ send_event(window, Awakened);
+ 0
+ },
+
_ => {
user32::DefWindowProcW(window, msg, wparam, lparam)
}
diff --git a/src/api/win32/mod.rs b/src/api/win32/mod.rs
index f580950..a4ca275 100644
--- a/src/api/win32/mod.rs
+++ b/src/api/win32/mod.rs
@@ -38,6 +38,10 @@ mod event;
mod init;
mod monitor;
+lazy_static! {
+ static ref WAKEUP_MSG_ID: u32 = unsafe { user32::RegisterWindowMessageA("Glutin::EventID".as_ptr() as *const i8) };
+}
+
/// The Win32 implementation of the main `Window` object.
pub struct Window {
/// Main handle for the window.
@@ -75,11 +79,15 @@ impl Drop for WindowWrapper {
}
#[derive(Clone)]
-pub struct WindowProxy;
+pub struct WindowProxy {
+ hwnd: winapi::HWND,
+}
impl WindowProxy {
pub fn wakeup_event_loop(&self) {
- unimplemented!()
+ unsafe {
+ user32::PostMessageA(self.hwnd, *WAKEUP_MSG_ID, 0, 0);
+ }
}
}
@@ -189,7 +197,7 @@ impl Window {
}
pub fn create_window_proxy(&self) -> WindowProxy {
- WindowProxy
+ WindowProxy { hwnd: self.window.0 }
}
/// See the docs in the crate root file.