From 0d25479c388492c2e0f20f04c47b4b1a48f32528 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Sat, 1 Mar 2014 02:58:48 -0800 Subject: [PATCH] MGR: Still more improvements and simplification of Mac code for wxCocoa 3.0 --- clientgui/AdvancedFrame.cpp | 7 ------ clientgui/BOINCBaseFrame.h | 4 ---- clientgui/BOINCGUIApp.cpp | 38 ++++++++----------------------- clientgui/sg_BoincSimpleFrame.cpp | 7 ------ 4 files changed, 9 insertions(+), 47 deletions(-) diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index f53f795e59..672392cc5c 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -1011,13 +1011,6 @@ void CAdvancedFrame::SaveWindowDimensions() { wxASSERT(pConfig); -#ifdef __WXMAC__ - // See comment in CBOINCGUIApp::ShowApplication() - if (pos.x >= OFFSCREEN_DELTA) { - pos.x -= OFFSCREEN_DELTA; - } -#endif - pConfig->SetPath(strBaseConfigLocation); bool iconized = IsIconized(); diff --git a/clientgui/BOINCBaseFrame.h b/clientgui/BOINCBaseFrame.h index 5207ff9267..37d4fcf27d 100644 --- a/clientgui/BOINCBaseFrame.h +++ b/clientgui/BOINCBaseFrame.h @@ -22,10 +22,6 @@ #pragma interface "BOINCBaseFrame.cpp" #endif -#ifdef __WXMAC__ -#define OFFSCREEN_DELTA 20000 -#endif - class CFrameEvent; class CFrameAlertEvent; diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index 74e64b2e1e..b7c9d0300c 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -990,10 +990,6 @@ bool CBOINCGUIApp::SetActiveGUI(int iGUISelection, bool bShowWindow) { // Make sure that the new window is going to be visible // on a screen #ifdef __WXMAC__ - // See comment in CBOINCGUIApp::ShowApplication() - if (iLeft >= OFFSCREEN_DELTA) { - iLeft -= OFFSCREEN_DELTA; - } if (!IsWindowOnScreen(iLeft, iTop, iWidth, iHeight)) { iTop = iLeft = 30; } @@ -1255,37 +1251,21 @@ extern void HideThisApp(void); /// #ifdef __WXMAC__ // We can "show" (unhide) the main window when the -// application is hidden and it won't be visible. But -// if we don't do this under wxCocoa 3.0, the Dock +// application is hidden and it won't be visible. +// If we don't do this under wxCocoa 3.0, the Dock // icon will bounce (as in notification) when we // click on our menu bar icon. -// However, there is a delay after we tell the OS to -// hide the application before it is actually hidden, -// so if we have the window hidden while displaying the -// About dialog, it may appear briefly when we close -// the dialog. As a work around, we move the window -// outside the screen bounds when hiding the application. - +// But wxFrame::Show(true) makes the application +// visible again, so call m_pFrame->wxWindow::Show() +// instead. void CBOINCGUIApp::ShowApplication(bool bShow) { - wxPoint pos = m_pFrame->GetPosition(); - if (bShow) { SetFrontProcess(&m_psnCurrentProcess); - if (m_pFrame) { - if (pos.x >= OFFSCREEN_DELTA) { - pos.x -= OFFSCREEN_DELTA; - m_pFrame->SetPosition(pos); - } - } - } else { // bShow == false - if (m_pFrame) { - if (pos.x < OFFSCREEN_DELTA) { - pos.x += OFFSCREEN_DELTA; - m_pFrame->SetPosition(pos); - } - m_pFrame->wxFrame::Show(); - } + } else { HideThisApp(); + if (m_pFrame) { + m_pFrame->wxWindow::Show(); + } } } #else diff --git a/clientgui/sg_BoincSimpleFrame.cpp b/clientgui/sg_BoincSimpleFrame.cpp index 1d235d6816..e64c64ed78 100755 --- a/clientgui/sg_BoincSimpleFrame.cpp +++ b/clientgui/sg_BoincSimpleFrame.cpp @@ -323,13 +323,6 @@ bool CSimpleFrame::SaveState() { // pConfig->SetPath(strBaseConfigLocation); -#ifdef __WXMAC__ - // See comment in CBOINCGUIApp::ShowApplication() - if (pos.x >= OFFSCREEN_DELTA) { - pos.x -= OFFSCREEN_DELTA; - } -#endif - pConfig->Write(wxT("XPos"), pos.x); pConfig->Write(wxT("YPos"), pos.y);