Skip to content

Commit

Permalink
Have the ability to disable screensaver due to Nvidia + Displayport c…
Browse files Browse the repository at this point in the history
…an cause annoying flickering

Bring up to standards guidelines and also support Windows

Switch this around...
  • Loading branch information
Sonicadvance1 authored and shuffle2 committed Aug 26, 2011
1 parent 7737b2c commit 62e790f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Source/Core/Core/Src/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ void SConfig::SaveSettings()
ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight);
ini.Set("Display", "RenderWindowAutoSize", m_LocalCoreStartupParameter.bRenderWindowAutoSize);
ini.Set("Display", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressive);
ini.Set("Display", "DisableScreenSaver", m_LocalCoreStartupParameter.bDisableScreenSaver);
ini.Set("Display", "ForceNTSCJ", m_LocalCoreStartupParameter.bForceNTSCJ);

// Game List Control
Expand Down Expand Up @@ -320,6 +321,7 @@ void SConfig::LoadSettings()
ini.Get("Display", "RenderWindowHeight", &m_LocalCoreStartupParameter.iRenderWindowHeight, 480);
ini.Get("Display", "RenderWindowAutoSize", &m_LocalCoreStartupParameter.bRenderWindowAutoSize, false);
ini.Get("Display", "ProgressiveScan", &m_LocalCoreStartupParameter.bProgressive, false);
ini.Get("Display", "DisableScreenSaver", &m_LocalCoreStartupParameter.bDisableScreenSaver, true);
ini.Get("Display", "ForceNTSCJ", &m_LocalCoreStartupParameter.bForceNTSCJ, false);

// Game List Control
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/CoreParameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ SCoreStartupParameter::SCoreStartupParameter()
iRenderWindowWidth(640), iRenderWindowHeight(480),
bRenderWindowAutoSize(false),
bFullscreen(false), bRenderToMain(false),
bProgressive(false),
bProgressive(false), bDisableScreenSaver(false),
iTheme(0),
iPosX(100), iPosY(100), iWidth(800), iHeight(600)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/CoreParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ struct SCoreStartupParameter
int iRenderWindowWidth, iRenderWindowHeight;
bool bRenderWindowAutoSize;
bool bFullscreen, bRenderToMain;
bool bProgressive;
bool bProgressive, bDisableScreenSaver;

int iTheme;
int iPosX, iPosY, iWidth, iHeight;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinWX/Src/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ WXLRESULT CRenderFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPa
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
if (Core::GetState() == Core::CORE_RUN)
if (Core::GetState() == Core::CORE_RUN && SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
break;
default:
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/DolphinWX/Src/FrameTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ void CFrame::StartGame(const std::string& filename)
else
{
#if defined(HAVE_X11) && HAVE_X11
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
X11Utils::XWindowFromHandle(GetHandle()), true);
#endif
Expand Down Expand Up @@ -1070,6 +1071,7 @@ void CFrame::DoStop()
wxEndBusyCursor();

#if defined(HAVE_X11) && HAVE_X11
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
X11Utils::XWindowFromHandle(GetHandle()), false);
#endif
Expand Down
7 changes: 4 additions & 3 deletions Source/Core/DolphinWX/Src/MainNoGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ void X11_MainLoop()
Window win = (Window)Core::GetWindowHandle();
XSelectInput(dpy, win, KeyPressMask | FocusChangeMask);

X11Utils::InhibitScreensaver(dpy, win, true);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
X11Utils::InhibitScreensaver(dpy, win, true);

#if defined(HAVE_XRANDR) && HAVE_XRANDR
X11Utils::XRRConfiguration *XRRConfig = new X11Utils::XRRConfiguration(dpy, win);
Expand Down Expand Up @@ -258,8 +259,8 @@ void X11_MainLoop()
#if defined(HAVE_XRANDR) && HAVE_XRANDR
delete XRRConfig;
#endif

X11Utils::InhibitScreensaver(dpy, win, false);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
X11Utils::InhibitScreensaver(dpy, win, false);

if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XFreeCursor(dpy, blankCursor);
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/VideoCommon/Src/EmuWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,12 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )

// Called when a screensaver wants to show up while this window is active
case WM_SYSCOMMAND:

switch (wParam)
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
break;
default:
return DefWindowProc(hWnd, iMsg, wParam, lParam);
Expand Down

0 comments on commit 62e790f

Please sign in to comment.