mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
Fix win32 window not closing when destroying it
This commit is contained in:
parent
64bbc4965f
commit
9e9a3ae03a
|
@ -719,6 +719,9 @@ extern "system" {
|
||||||
pub fn PeekMessageW(lpMsg: *mut MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT,
|
pub fn PeekMessageW(lpMsg: *mut MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT,
|
||||||
wRemoveMsg: UINT) -> BOOL;
|
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
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms644945(v=vs.85).aspx
|
||||||
pub fn PostQuitMessage(nExitCode: libc::c_int);
|
pub fn PostQuitMessage(nExitCode: libc::c_int);
|
||||||
|
|
||||||
|
|
|
@ -239,6 +239,7 @@ impl Window {
|
||||||
impl Drop for Window {
|
impl Drop for Window {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
unsafe { ffi::PostMessageW(self.window, ffi::WM_DESTROY, 0, 0); }
|
||||||
unsafe { ffi::wgl::MakeCurrent(ptr::null(), ptr::null()); }
|
unsafe { ffi::wgl::MakeCurrent(ptr::null(), ptr::null()); }
|
||||||
unsafe { ffi::wgl::DeleteContext(self.context); }
|
unsafe { ffi::wgl::DeleteContext(self.context); }
|
||||||
unsafe { ffi::DestroyWindow(self.window); }
|
unsafe { ffi::DestroyWindow(self.window); }
|
||||||
|
|
Loading…
Reference in a new issue