Fix checks for preventing the main and render windows from spawning off screen.

This commit is contained in:
Rachel Bryk
2013-03-15 09:19:39 -04:00
parent afb6f9127a
commit def578fea6
2 changed files with 10 additions and 8 deletions

View File

@ -865,10 +865,11 @@ void CFrame::StartGame(const std::string& filename)
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight); SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
#ifdef _WIN32 #ifdef _WIN32
// Out of desktop check // Out of desktop check
HWND hDesktop = GetDesktopWindow(); int height = GetSystemMetrics(79);
RECT rc; int width = GetSystemMetrics(78);
GetWindowRect(hDesktop, &rc); int leftPos = GetSystemMetrics(76);
if (rc.right < position.x + size.GetWidth() || rc.bottom < position.y + size.GetHeight()) int topPos = GetSystemMetrics(77);
if ((leftPos + width) < (position.x + size.GetWidth()) || leftPos > position.x || (topPos + height) < (position.y + size.GetHeight()) || topPos > position.y)
position.x = position.y = wxDefaultCoord; position.x = position.y = wxDefaultCoord;
#endif #endif
m_RenderFrame = new CRenderFrame((wxFrame*)this, wxID_ANY, _("Dolphin"), position); m_RenderFrame = new CRenderFrame((wxFrame*)this, wxID_ANY, _("Dolphin"), position);

View File

@ -294,10 +294,11 @@ bool DolphinApp::OnInit()
// do not allow windows to be created off the desktop. // do not allow windows to be created off the desktop.
#ifdef _WIN32 #ifdef _WIN32
// Out of desktop check // Out of desktop check
HWND hDesktop = GetDesktopWindow(); int height = GetSystemMetrics(79);
RECT rc; int width = GetSystemMetrics(78);
GetWindowRect(hDesktop, &rc); int leftPos = GetSystemMetrics(76);
if (rc.right < x + w || rc.bottom < y + h) int topPos = GetSystemMetrics(77);
if ((leftPos + width) < (x + w) || leftPos > x || (topPos + height) < (y + h) || topPos > y)
x = y = wxDefaultCoord; x = y = wxDefaultCoord;
#elif defined __APPLE__ #elif defined __APPLE__
if (y < 1) if (y < 1)