From 2680ddc6787e05b9eb058091e252e28f925d533c Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 22 Apr 2010 06:18:15 +0000 Subject: [PATCH] shutdown sequence routing to EndSession calls git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64094 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/app.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/osx/carbon/app.cpp b/src/osx/carbon/app.cpp index f4a209b0a7..273c280db6 100644 --- a/src/osx/carbon/app.cpp +++ b/src/osx/carbon/app.cpp @@ -249,18 +249,13 @@ short wxApp::MacHandleAEOApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply)) { - wxWindow* win = GetTopWindow() ; - if ( win ) + wxCloseEvent event; + wxTheApp->OnQueryEndSession(event); + if ( !event.GetVeto() ) { - wxCommandEvent exitEvent(wxEVT_COMMAND_MENU_SELECTED, s_macExitMenuItemId); - if (!win->GetEventHandler()->ProcessEvent(exitEvent)) - win->Close(true) ; + wxCloseEvent event; + wxTheApp->OnEndSession(event); } - else - { - ExitMainLoop() ; - } - return noErr ; } @@ -1127,10 +1122,17 @@ void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) // user can veto the close, and therefore the end session. void wxApp::OnQueryEndSession(wxCloseEvent& event) { - if (GetTopWindow()) + if ( !wxDialog::OSXHasModalDialogsOpen() ) + { + if (GetTopWindow()) + { + if (!GetTopWindow()->Close(!event.CanVeto())) + event.Veto(true); + } + } + else { - if (!GetTopWindow()->Close(!event.CanVeto())) - event.Veto(true); + event.Veto(true); } } -- 2.45.2