Prevent the render window from spawning off screen.

Fixes issue 6063.
This commit is contained in:
Rachel Bryk 2013-03-14 05:27:49 -04:00
parent c93f7760ce
commit eaebebc33d
1 changed files with 10 additions and 2 deletions

View File

@ -861,14 +861,22 @@ void CFrame::StartGame(const std::string& filename)
position = wxDefaultPosition; position = wxDefaultPosition;
#endif #endif
wxSize size(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
#ifdef _WIN32
// Out of desktop check
HWND hDesktop = GetDesktopWindow();
RECT rc;
GetWindowRect(hDesktop, &rc);
if (rc.right < position.x + size.GetWidth() || rc.bottom < position.y + size.GetHeight())
position.x = position.y = wxDefaultCoord;
#endif
m_RenderFrame = new CRenderFrame((wxFrame*)this, wxID_ANY, _("Dolphin"), position); m_RenderFrame = new CRenderFrame((wxFrame*)this, wxID_ANY, _("Dolphin"), position);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bKeepWindowOnTop) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bKeepWindowOnTop)
m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() | wxSTAY_ON_TOP); m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() | wxSTAY_ON_TOP);
else else
m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() & ~wxSTAY_ON_TOP); m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() & ~wxSTAY_ON_TOP);
wxSize size(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
m_RenderFrame->SetClientSize(size.GetWidth(), size.GetHeight()); m_RenderFrame->SetClientSize(size.GetWidth(), size.GetHeight());
m_RenderFrame->Bind(wxEVT_CLOSE_WINDOW, &CFrame::OnRenderParentClose, this); m_RenderFrame->Bind(wxEVT_CLOSE_WINDOW, &CFrame::OnRenderParentClose, this);
m_RenderFrame->Bind(wxEVT_ACTIVATE, &CFrame::OnActive, this); m_RenderFrame->Bind(wxEVT_ACTIVATE, &CFrame::OnActive, this);