MGR: Fix save and restore of main window position on Mac

This commit is contained in:
Charlie Fenton 2014-02-28 04:01:58 -08:00
parent 28268086a7
commit 0fc3952d68
5 changed files with 29 additions and 7 deletions

View File

@ -1011,6 +1011,13 @@ 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();
@ -1729,7 +1736,7 @@ void CAdvancedFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
if (!wasVisible) {
wxGetApp().ShowApplication(false);
}
#ifndef __WXMAC__ // See explanation in ShowApplication()
#ifndef __WXMAC__ // See comment in CBOINCGUIApp::ShowApplication()
if (!wasShown) {
Hide();
}

View File

@ -317,7 +317,7 @@ void CBOINCBaseFrame::OnClose(wxCloseEvent& event) {
// again. Just minimize the window instead.
Iconize();
#elif defined(__WXMAC__)
// See explanation in CBOINCGUIApp::ShowApplication().
// See comment in CBOINCGUIApp::ShowApplication().
wxGetApp().ShowApplication(false);
#else
Hide();

View File

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

View File

@ -990,6 +990,10 @@ 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;
}
@ -1250,8 +1254,6 @@ extern void HideThisApp(void);
/// true will show the process, false will hide the process.
///
#ifdef __WXMAC__
#define OFFSCREEN_DELTA 20000
// 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

View File

@ -308,6 +308,7 @@ bool CSimpleFrame::SaveState() {
CBOINCBaseFrame::SaveState();
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
wxString strBaseConfigLocation = wxString(wxT("/Simple"));
wxPoint pos = GetPosition();
wxASSERT(pConfig);
@ -322,8 +323,15 @@ bool CSimpleFrame::SaveState() {
//
pConfig->SetPath(strBaseConfigLocation);
pConfig->Write(wxT("XPos"), GetPosition().x);
pConfig->Write(wxT("YPos"), GetPosition().y);
#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);
return true;
}
@ -685,7 +693,7 @@ void CSimpleFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
if (!wasVisible) {
wxGetApp().ShowApplication(false);
}
#ifndef __WXMAC__ // See explanation in ShowApplication()
#ifndef __WXMAC__ // See comment in CBOINCGUIApp::ShowApplication()
if (!wasShown) {
Hide();
}