From e3730a2440dbab86ce7c56fdba3fddc108b35963 Mon Sep 17 00:00:00 2001 From: ayuanx Date: Mon, 25 Jan 2010 12:17:48 +0000 Subject: [PATCH] If the saved position is out of screen, start Dolphin in default position. e.g. When last time you closed Dolphin on a second monitor but now you have ejected that monitor or have changed the position from horizontal tile to vertical tile. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4957 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/Frame.cpp | 1 - Source/Core/DolphinWX/Src/Main.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 65ba59f3c0..afab7f8a54 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -534,7 +534,6 @@ void CFrame::OnClose(wxCloseEvent& event) // Don't forget the skip or the window won't be destroyed event.Skip(); // Save GUI settings - if (g_pCodeWindow) g_pCodeWindow->Save(); if (g_pCodeWindow) Save(); // Uninit m_Mgr->UnInit(); diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 5f3bb9cead..b39a6f1411 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -399,6 +399,16 @@ bool DolphinApp::OnInit() int w = SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth; int h = SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight; +// TODO: Do the same check for Linux +#ifdef _WIN32 + // Out of desktop check + HWND hDesktop = GetDesktopWindow(); + RECT rc; + GetWindowRect(hDesktop, &rc); + if (rc.right < x + w || rc.bottom < y + h) + x = y = -1; +#endif + main_frame = new CFrame((wxFrame*)NULL, wxID_ANY, wxString::FromAscii(title), wxPoint(x, y), wxSize(w, h), UseDebugger, UseLogger);