diff --git a/checkin_notes b/checkin_notes index 2a18da2017..9df265b6e9 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11760,6 +11760,8 @@ Rom 29 Oct 2006 Charlie 29 Oct 2006 - Mac: fix some Mac-specific Simple GUI bugs. + - Mac: Don't run confirmation dialog on QUIT AppleEvent so dialog + doesn't prevent logout / shutdown. clientgui/ AdvancedFrame.cpp, h diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index fb368c7996..fc08eb378c 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -1048,6 +1048,14 @@ void CAdvancedFrame::OnCloseWindow(wxCommandEvent& WXUNUSED(event)) { void CAdvancedFrame::OnExit(wxCommandEvent& WXUNUSED(event)) { wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnExit - Function Begin")); +#ifdef __WXMAC__ + // Don't run confirmation dialog if logging out or shutting down + if (wxGetApp().GetQuittingByAppleEvent()) { + Close(true); + return; + } +#endif + if (m_iDisplayExitWarning) { CDlgGenericMessage* pDlg = new CDlgGenericMessage(this); wxString strMessage = wxGetApp().GetSkinManager()->GetAdvanced()->GetExitMessage(); diff --git a/clientgui/BOINCBaseFrame.cpp b/clientgui/BOINCBaseFrame.cpp index 959d1fcfda..cab0b6ac76 100644 --- a/clientgui/BOINCBaseFrame.cpp +++ b/clientgui/BOINCBaseFrame.cpp @@ -563,7 +563,7 @@ bool CBOINCBaseFrame::Show(bool show) { SetFrontProcess(&psn); // Shows process if hidden } else { // GetWindowDimensions(); - if (wxGetApp().GetCurrentGUISelection() == m_windowType) + if (wxGetApp().GetCurrentGUISelection() == m_iWindowType) if (IsProcessVisible(&psn)) ShowHideProcess(&psn, false); } diff --git a/clientgui/BOINCBaseFrame.h b/clientgui/BOINCBaseFrame.h index 0788f93fa1..143db914d8 100644 --- a/clientgui/BOINCBaseFrame.h +++ b/clientgui/BOINCBaseFrame.h @@ -84,7 +84,7 @@ public: #ifdef __WXMAC__ bool Show( bool show = true ); - int m_windowType; // BOINC_SIMPLEGUI or BOINC_ADVANCEDGUI + int m_iWindowType; // BOINC_SIMPLEGUI or BOINC_ADVANCEDGUI #endif protected: diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index 6405a43175..6ac5e81247 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -55,6 +55,7 @@ #include "sg_BoincSimpleGUI.h" #endif +static bool s_bQuittingByAppleEvent; #ifdef __WXMSW__ EXTERN_C BOOL IsBOINCServiceInstalled(); @@ -297,6 +298,9 @@ bool CBOINCGUIApp::OnInit() { StartupBOINCCore(); #ifdef __WXMAC__ + s_bQuittingByAppleEvent = false; + AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler), 0, false ); + m_pMacSystemMenu = new CMacSystemMenu( m_pSkinManager->GetAdvanced()->GetApplicationName(), m_pSkinManager->GetAdvanced()->GetApplicationIcon(), @@ -791,6 +795,16 @@ void CBOINCGUIApp::ShutdownBOINCCore() { } } + +OSErr CBOINCGUIApp::QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon ) { + s_bQuittingByAppleEvent = true; + return wxGetApp().MacHandleAEQuit((AppleEvent*)appleEvt, reply); +} + +bool CBOINCGUIApp::GetQuittingByAppleEvent() { + return s_bQuittingByAppleEvent; +} + #else void CBOINCGUIApp::ShutdownBOINCCore() { @@ -944,7 +958,7 @@ bool CBOINCGUIApp::SetActiveGUI(int iGUISelection, bool bShowWindow) { #ifdef __WXMAC__ // So closing old view doesn't hide application - pNewFrame->m_windowType = iGUISelection; + pNewFrame->m_iWindowType = iGUISelection; m_iGUISelected = iGUISelection; #endif // Delete the old one if it exists diff --git a/clientgui/BOINCGUIApp.h b/clientgui/BOINCGUIApp.h index dc7b98dc55..8c5cf822ae 100644 --- a/clientgui/BOINCGUIApp.h +++ b/clientgui/BOINCGUIApp.h @@ -72,6 +72,7 @@ protected: CTaskBarIcon* m_pTaskBarIcon; #ifdef __WXMAC__ CMacSystemMenu* m_pMacSystemMenu; + static OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon ); #endif bool m_bBOINCStartedByManager; @@ -114,6 +115,7 @@ public: #ifdef __WXMAC__ CMacSystemMenu* GetMacSystemMenu() { return m_pMacSystemMenu; } int GetCurrentGUISelection() { return m_iGUISelected; } + bool GetQuittingByAppleEvent(); #endif wxArrayString& GetSupportedLanguages() { return m_astrLanguages; }