Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Prevent the render window from spawning off screen.
Fixes issue 6063.
  • Loading branch information
RachelBryk committed Mar 14, 2013
1 parent c93f776 commit eaebebc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Source/Core/DolphinWX/Src/FrameTools.cpp
Expand Up @@ -861,14 +861,22 @@ void CFrame::StartGame(const std::string& filename)
position = wxDefaultPosition;
#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);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bKeepWindowOnTop)
m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() | wxSTAY_ON_TOP);
else
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->Bind(wxEVT_CLOSE_WINDOW, &CFrame::OnRenderParentClose, this);
m_RenderFrame->Bind(wxEVT_ACTIVATE, &CFrame::OnActive, this);
Expand Down

0 comments on commit eaebebc

Please sign in to comment.