From 9e9a3ae03a96593de9b81948a347da1a41c7c1a6 Mon Sep 17 00:00:00 2001 From: Tomaka17 Date: Sat, 11 Oct 2014 20:52:48 +0200 Subject: Fix win32 window not closing when destroying it --- src/win32/ffi.rs | 3 +++ src/win32/mod.rs | 1 + 2 files changed, 4 insertions(+) (limited to 'src/win32') 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); } -- cgit v1.2.3