summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/FrameTools.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-07-11 23:45:53 +0200
committerGitHub <noreply@github.com>2016-07-11 23:45:53 +0200
commitac00b249aaf223d2d16755c04e353b6f5174bfe7 (patch)
treea3f9c5fb6f0b9d9daa77e49d31e98167c649cfbb /Source/Core/DolphinWX/FrameTools.cpp
parent2de6d073605566b76ad464c1bb967630cf2eeae4 (diff)
parent0856e162a3b1d68fd26cc1cbcbafb4b0a4594eb8 (diff)
Merge pull request #3985 from thegrb93/master
Prevent windows from idling while playing a game with a gc controller
Diffstat (limited to 'Source/Core/DolphinWX/FrameTools.cpp')
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index 44de0e8e99..6b07736d7a 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -1034,6 +1034,13 @@ void CFrame::StartGame(const std::string& filename)
X11Utils::XWindowFromHandle(GetHandle()), true);
#endif
+#ifdef _WIN32
+ // Prevents Windows from sleeping, turning off the display, or idling
+ EXECUTION_STATE shouldScreenSave =
+ SConfig::GetInstance().bDisableScreenSaver ? ES_DISPLAY_REQUIRED : 0;
+ SetThreadExecutionState(ES_CONTINUOUS | shouldScreenSave | ES_SYSTEM_REQUIRED);
+#endif
+
m_RenderParent->SetFocus();
wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
@@ -1181,6 +1188,12 @@ void CFrame::OnStopped()
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
X11Utils::XWindowFromHandle(GetHandle()), false);
#endif
+
+#ifdef _WIN32
+ // Allow windows to resume normal idling behavior
+ SetThreadExecutionState(ES_CONTINUOUS);
+#endif
+
m_RenderFrame->SetTitle(StrToWxStr(scm_rev_str));
// Destroy the renderer frame when not rendering to main