Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 240 alternative fix #247

Merged
merged 5 commits into from Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/platform/windows/events_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
-> winapi::LRESULT
{
match msg {
winapi::WM_DESTROY => {
winapi::WM_CLOSE => {
use events::WindowEvent::Closed;
send_event(Event::WindowEvent {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Window removal might be postponed to WM_DESTROY, and only the event es emitted here, but i'm not sure if it is required.

window_id: SuperWindowId(WindowId(window)),
Expand All @@ -291,7 +291,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
let mut context_stash = context_stash.borrow_mut();
context_stash.as_mut().unwrap().windows.remove(&window);
});
0
user32::DefWindowProcW(window, msg, wparam, lparam)
},

winapi::WM_ERASEBKGND => {
Expand Down
4 changes: 3 additions & 1 deletion src/platform/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ impl Drop for Window {
#[inline]
fn drop(&mut self) {
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);
}
}
}
Expand Down