aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/win32/ffi.rs3
-rw-r--r--src/win32/mod.rs2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/win32/ffi.rs b/src/win32/ffi.rs
index 5a8732d..2385954 100644
--- a/src/win32/ffi.rs
+++ b/src/win32/ffi.rs
@@ -719,6 +719,9 @@ extern "system" {
pub fn PeekMessageW(lpMsg: *mut MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT,
wRemoveMsg: UINT) -> BOOL;
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/ms644944(v=vs.85).aspx
+ pub fn PostMessageW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL;
+
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms644945(v=vs.85).aspx
pub fn PostQuitMessage(nExitCode: libc::c_int);
diff --git a/src/win32/mod.rs b/src/win32/mod.rs
index 720010c..8be3fdb 100644
--- a/src/win32/mod.rs
+++ b/src/win32/mod.rs
@@ -235,11 +235,11 @@ impl Window {
}
}
-#[cfg(feature = "window")]
#[unsafe_destructor]
impl Drop for Window {
fn drop(&mut self) {
use std::ptr;
+ unsafe { ffi::PostMessageW(self.window, ffi::WM_DESTROY, 0, 0); }
unsafe { ffi::wgl::MakeCurrent(ptr::null(), ptr::null()); }
unsafe { ffi::wgl::DeleteContext(self.context); }
unsafe { ffi::DestroyWindow(self.window); }