mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-12 05:31:31 +11:00
Merge pull request #247 from zpgaal/issue_240_simple
Issue 240 alternative fix
This commit is contained in:
commit
718e0f8551
|
@ -281,7 +281,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
|
||||||
-> winapi::LRESULT
|
-> winapi::LRESULT
|
||||||
{
|
{
|
||||||
match msg {
|
match msg {
|
||||||
winapi::WM_DESTROY => {
|
winapi::WM_CLOSE => {
|
||||||
use events::WindowEvent::Closed;
|
use events::WindowEvent::Closed;
|
||||||
send_event(Event::WindowEvent {
|
send_event(Event::WindowEvent {
|
||||||
window_id: SuperWindowId(WindowId(window)),
|
window_id: SuperWindowId(WindowId(window)),
|
||||||
|
@ -291,7 +291,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
|
||||||
let mut context_stash = context_stash.borrow_mut();
|
let mut context_stash = context_stash.borrow_mut();
|
||||||
context_stash.as_mut().unwrap().windows.remove(&window);
|
context_stash.as_mut().unwrap().windows.remove(&window);
|
||||||
});
|
});
|
||||||
0
|
user32::DefWindowProcW(window, msg, wparam, lparam)
|
||||||
},
|
},
|
||||||
|
|
||||||
winapi::WM_ERASEBKGND => {
|
winapi::WM_ERASEBKGND => {
|
||||||
|
|
|
@ -282,7 +282,9 @@ impl Drop for Window {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
user32::PostMessageW(self.window.0, winapi::WM_DESTROY, 0, 0);
|
// We are sending WM_CLOSE, and our callback will process this by calling DefWindowProcW,
|
||||||
|
// which in turn will send a WM_DESTROY.
|
||||||
|
user32::PostMessageW(self.window.0, winapi::WM_CLOSE, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue