aboutsummaryrefslogtreecommitdiff
path: root/src/osx/gui/Window.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/osx/gui/Window.mm')
-rw-r--r--src/osx/gui/Window.mm21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/osx/gui/Window.mm b/src/osx/gui/Window.mm
index 1a42f340..a0542147 100644
--- a/src/osx/gui/Window.mm
+++ b/src/osx/gui/Window.mm
@@ -53,9 +53,28 @@ OsxWindowPrivate::OsxWindowPrivate(OsxWindow* osx_window) : osx_window_(osx_wind
OsxWindowPrivate::~OsxWindowPrivate() {}
void OsxWindowPrivate::OnWindowWillClose() {
- destroy_event_.Raise(nullptr);
+ if (window_) destroy_event_.Raise(nullptr);
window_ = nil;
CGLayerRelease(draw_layer_);
+ draw_layer_ = nullptr;
+
+ if (osx_window_->GetUiApplication()->IsQuitOnAllWindowClosed()) {
+ const auto& all_window = osx_window_->GetUiApplication()->GetAllWindow();
+
+ bool quit = true;
+
+ for (auto window : all_window) {
+ auto w = CheckPlatform<OsxWindow>(window, osx_window_->GetPlatformId());
+ if (w->p_->window_) {
+ quit = false;
+ break;
+ }
+ }
+
+ if (quit) {
+ osx_window_->GetUiApplication()->RequestQuit(0);
+ }
+ }
}
void OsxWindowPrivate::OnWindowDidExpose() { osx_window_->RequestRepaint(); }