summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorGerik Kubiak <gerikkub@gmail.com>2015-03-16 20:28:17 -0700
committerGerik Kubiak <gerikkub@gmail.com>2015-03-16 20:28:17 -0700
commit341e7e9d8ff6c77d7eaba4d47e56044203ee80e2 (patch)
tree48087ee96d17c3e530f286b44465f0c44ff4a515 /Source
parent7cda374910ffa9fc9680035ea77083b1cc0d14d9 (diff)
Added the ability to pause the emulator by moving the mouse outside the window.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/ConfigManager.cpp2
-rw-r--r--Source/Core/Core/ConfigManager.h2
-rw-r--r--Source/Core/DolphinWX/Frame.cpp27
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp16
4 files changed, 40 insertions, 7 deletions
diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp
index 6fc09c46d5..225fe04a00 100644
--- a/Source/Core/Core/ConfigManager.cpp
+++ b/Source/Core/Core/ConfigManager.cpp
@@ -242,6 +242,7 @@ void SConfig::SaveInterfaceSettings(IniFile& ini)
interface->Set("ShowLogConfigWindow", m_InterfaceLogConfigWindow);
interface->Set("ExtendedFPSInfo", m_InterfaceExtendedFPSInfo);
interface->Set("ThemeName40", m_LocalCoreStartupParameter.theme_name);
+ interface->Set("PauseOnFocusLost", m_PauseOnFocusLost);
}
void SConfig::SaveHotkeySettings(IniFile& ini)
@@ -464,6 +465,7 @@ void SConfig::LoadInterfaceSettings(IniFile& ini)
interface->Get("ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false);
interface->Get("ExtendedFPSInfo", &m_InterfaceExtendedFPSInfo, false);
interface->Get("ThemeName40", &m_LocalCoreStartupParameter.theme_name, "Clean");
+ interface->Get("PauseOnFocusLost", &m_PauseOnFocusLost, false);
}
void SConfig::LoadHotkeySettings(IniFile& ini)
diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h
index 80f0523208..cac39cbb31 100644
--- a/Source/Core/Core/ConfigManager.h
+++ b/Source/Core/Core/ConfigManager.h
@@ -103,6 +103,8 @@ struct SConfig : NonCopyable
bool m_DumpFramesSilent;
bool m_ShowInputDisplay;
+ bool m_PauseOnFocusLost;
+
// DSP settings
bool m_DSPEnableJIT;
bool m_DSPCaptureLog;
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index ff82e1cd65..3678d349c5 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -1121,6 +1121,33 @@ void CFrame::OnKeyUp(wxKeyEvent& event)
void CFrame::OnMouse(wxMouseEvent& event)
{
+ if (SConfig::GetInstance().m_PauseOnFocusLost &&
+ event.GetEventObject() == (wxObject*)m_RenderParent)
+ {
+ if (event.Leaving())
+ {
+ if (Core::GetState() == Core::CORE_RUN)
+ {
+ Core::SetState(Core::CORE_PAUSE);
+ if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
+ m_RenderParent->SetCursor(wxNullCursor);
+ Core::UpdateTitle();
+ }
+ UpdateGUI();
+ }
+ else if (event.Entering())
+ {
+ if (Core::GetState() == Core::CORE_PAUSE)
+ {
+ Core::SetState(Core::CORE_RUN);
+ if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
+ m_RenderParent->SetCursor(wxCURSOR_BLANK);
+ }
+ UpdateGUI();
+ }
+ }
+
+
// next handlers are all for FreeLook, so we don't need to check them if disabled
if (!g_Config.bFreeLook)
{
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index 31d366a55a..b61f093c18 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -1073,13 +1073,15 @@ void CFrame::StartGame(const std::string& filename)
m_RenderParent->SetFocus();
- wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
- wxTheApp->Bind(wxEVT_KEY_UP, &CFrame::OnKeyUp, this);
- wxTheApp->Bind(wxEVT_RIGHT_DOWN, &CFrame::OnMouse, this);
- wxTheApp->Bind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this);
- wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);
- wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
- wxTheApp->Bind(wxEVT_MOTION, &CFrame::OnMouse, this);
+ wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
+ wxTheApp->Bind(wxEVT_KEY_UP, &CFrame::OnKeyUp, this);
+ wxTheApp->Bind(wxEVT_RIGHT_DOWN, &CFrame::OnMouse, this);
+ wxTheApp->Bind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this);
+ wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);
+ wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
+ wxTheApp->Bind(wxEVT_MOTION, &CFrame::OnMouse, this);
+ wxTheApp->Bind(wxEVT_ENTER_WINDOW, &CFrame::OnMouse, this);
+ wxTheApp->Bind(wxEVT_LEAVE_WINDOW, &CFrame::OnMouse, this);
m_RenderParent->Bind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this);
}