MGR: Still more improvements and simplification of Mac code for wxCocoa 3.0

This commit is contained in:
Charlie Fenton 2014-03-01 02:58:48 -08:00
parent 589fb7c84f
commit 0d25479c38
4 changed files with 9 additions and 47 deletions

View File

@ -1011,13 +1011,6 @@ void CAdvancedFrame::SaveWindowDimensions() {
wxASSERT(pConfig); wxASSERT(pConfig);
#ifdef __WXMAC__
// See comment in CBOINCGUIApp::ShowApplication()
if (pos.x >= OFFSCREEN_DELTA) {
pos.x -= OFFSCREEN_DELTA;
}
#endif
pConfig->SetPath(strBaseConfigLocation); pConfig->SetPath(strBaseConfigLocation);
bool iconized = IsIconized(); bool iconized = IsIconized();

View File

@ -22,10 +22,6 @@
#pragma interface "BOINCBaseFrame.cpp" #pragma interface "BOINCBaseFrame.cpp"
#endif #endif
#ifdef __WXMAC__
#define OFFSCREEN_DELTA 20000
#endif
class CFrameEvent; class CFrameEvent;
class CFrameAlertEvent; class CFrameAlertEvent;

View File

@ -990,10 +990,6 @@ bool CBOINCGUIApp::SetActiveGUI(int iGUISelection, bool bShowWindow) {
// Make sure that the new window is going to be visible // Make sure that the new window is going to be visible
// on a screen // on a screen
#ifdef __WXMAC__ #ifdef __WXMAC__
// See comment in CBOINCGUIApp::ShowApplication()
if (iLeft >= OFFSCREEN_DELTA) {
iLeft -= OFFSCREEN_DELTA;
}
if (!IsWindowOnScreen(iLeft, iTop, iWidth, iHeight)) { if (!IsWindowOnScreen(iLeft, iTop, iWidth, iHeight)) {
iTop = iLeft = 30; iTop = iLeft = 30;
} }
@ -1255,37 +1251,21 @@ extern void HideThisApp(void);
/// ///
#ifdef __WXMAC__ #ifdef __WXMAC__
// We can "show" (unhide) the main window when the // We can "show" (unhide) the main window when the
// application is hidden and it won't be visible. But // application is hidden and it won't be visible.
// if we don't do this under wxCocoa 3.0, the Dock // If we don't do this under wxCocoa 3.0, the Dock
// icon will bounce (as in notification) when we // icon will bounce (as in notification) when we
// click on our menu bar icon. // click on our menu bar icon.
// However, there is a delay after we tell the OS to // But wxFrame::Show(true) makes the application
// hide the application before it is actually hidden, // visible again, so call m_pFrame->wxWindow::Show()
// so if we have the window hidden while displaying the // instead.
// 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.
void CBOINCGUIApp::ShowApplication(bool bShow) { void CBOINCGUIApp::ShowApplication(bool bShow) {
wxPoint pos = m_pFrame->GetPosition();
if (bShow) { if (bShow) {
SetFrontProcess(&m_psnCurrentProcess); SetFrontProcess(&m_psnCurrentProcess);
if (m_pFrame) { } else {
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();
}
HideThisApp(); HideThisApp();
if (m_pFrame) {
m_pFrame->wxWindow::Show();
}
} }
} }
#else #else

View File

@ -323,13 +323,6 @@ bool CSimpleFrame::SaveState() {
// //
pConfig->SetPath(strBaseConfigLocation); 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("XPos"), pos.x);
pConfig->Write(wxT("YPos"), pos.y); pConfig->Write(wxT("YPos"), pos.y);