]> git.saurik.com Git - wxWidgets.git/commitdiff
shutdown sequence routing to EndSession calls
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 22 Apr 2010 06:18:15 +0000 (06:18 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 22 Apr 2010 06:18:15 +0000 (06:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64094 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/carbon/app.cpp

index f4a209b0a78911ff2f73ba4a921c04353a6d3475..273c280db6d086c70ac755393672dc1e9f6b6917 100644 (file)
@@ -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);
     }
 }