aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTomaka17 <pierre.krieger1708@gmail.com>2014-10-11 20:52:48 +0200
committerTomaka17 <pierre.krieger1708@gmail.com>2014-10-11 20:52:48 +0200
commit9e9a3ae03a96593de9b81948a347da1a41c7c1a6 (patch)
tree920ec04f7e67e0474952db1a851cd07b881e6f9a /src
parent64bbc4965f3ab6a829a9f421c11b7bead6d49a17 (diff)
downloadglutin-9e9a3ae03a96593de9b81948a347da1a41c7c1a6.tar.gz
glutin-9e9a3ae03a96593de9b81948a347da1a41c7c1a6.zip
Fix win32 window not closing when destroying it
Diffstat (limited to 'src')
-rw-r--r--src/win32/ffi.rs3
-rw-r--r--src/win32/mod.rs1
2 files changed, 4 insertions, 0 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 ee0e2b2..8be3fdb 100644
--- a/src/win32/mod.rs
+++ b/src/win32/mod.rs
@@ -239,6 +239,7 @@ impl Window {
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); }