Close NSWindow when Window is dropped if not already closed.
Previously, if a `Window` was `Drop`ped while open, the window would remain open until the user pressed the x button. This fixes the behaviour so that the window is closed when dropped if it has not already been closed.
This commit is contained in:
parent
27bd796c2a
commit
4656540417
1 changed files with 8 additions and 0 deletions
|
|
@ -181,6 +181,14 @@ impl Drop for Window {
|
||||||
if let Some(ev) = self.delegate.state.events_loop.upgrade() {
|
if let Some(ev) = self.delegate.state.events_loop.upgrade() {
|
||||||
ev.find_and_remove_window(id);
|
ev.find_and_remove_window(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close the window if it has not yet been closed.
|
||||||
|
let nswindow = *self.window;
|
||||||
|
if nswindow != nil {
|
||||||
|
unsafe {
|
||||||
|
msg_send![nswindow, close];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue