Have the ability to disable screensaver due to Nvidia + Displayport can cause annoying flickering

Bring up to standards guidelines and also support Windows

Switch this around...
This commit is contained in:
Ryan Houdek 2011-08-25 14:44:13 -05:00 committed by Shawn Hoffman
parent 7737b2cef1
commit 62e790f109
7 changed files with 13 additions and 6 deletions

View File

@ -191,6 +191,7 @@ void SConfig::SaveSettings()
ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight); ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight);
ini.Set("Display", "RenderWindowAutoSize", m_LocalCoreStartupParameter.bRenderWindowAutoSize); ini.Set("Display", "RenderWindowAutoSize", m_LocalCoreStartupParameter.bRenderWindowAutoSize);
ini.Set("Display", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressive); ini.Set("Display", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressive);
ini.Set("Display", "DisableScreenSaver", m_LocalCoreStartupParameter.bDisableScreenSaver);
ini.Set("Display", "ForceNTSCJ", m_LocalCoreStartupParameter.bForceNTSCJ); ini.Set("Display", "ForceNTSCJ", m_LocalCoreStartupParameter.bForceNTSCJ);
// Game List Control // Game List Control
@ -320,6 +321,7 @@ void SConfig::LoadSettings()
ini.Get("Display", "RenderWindowHeight", &m_LocalCoreStartupParameter.iRenderWindowHeight, 480); ini.Get("Display", "RenderWindowHeight", &m_LocalCoreStartupParameter.iRenderWindowHeight, 480);
ini.Get("Display", "RenderWindowAutoSize", &m_LocalCoreStartupParameter.bRenderWindowAutoSize, false); ini.Get("Display", "RenderWindowAutoSize", &m_LocalCoreStartupParameter.bRenderWindowAutoSize, false);
ini.Get("Display", "ProgressiveScan", &m_LocalCoreStartupParameter.bProgressive, 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); ini.Get("Display", "ForceNTSCJ", &m_LocalCoreStartupParameter.bForceNTSCJ, false);
// Game List Control // Game List Control

View File

@ -59,7 +59,7 @@ SCoreStartupParameter::SCoreStartupParameter()
iRenderWindowWidth(640), iRenderWindowHeight(480), iRenderWindowWidth(640), iRenderWindowHeight(480),
bRenderWindowAutoSize(false), bRenderWindowAutoSize(false),
bFullscreen(false), bRenderToMain(false), bFullscreen(false), bRenderToMain(false),
bProgressive(false), bProgressive(false), bDisableScreenSaver(false),
iTheme(0), iTheme(0),
iPosX(100), iPosY(100), iWidth(800), iHeight(600) iPosX(100), iPosY(100), iWidth(800), iHeight(600)
{ {

View File

@ -135,7 +135,7 @@ struct SCoreStartupParameter
int iRenderWindowWidth, iRenderWindowHeight; int iRenderWindowWidth, iRenderWindowHeight;
bool bRenderWindowAutoSize; bool bRenderWindowAutoSize;
bool bFullscreen, bRenderToMain; bool bFullscreen, bRenderToMain;
bool bProgressive; bool bProgressive, bDisableScreenSaver;
int iTheme; int iTheme;
int iPosX, iPosY, iWidth, iHeight; int iPosX, iPosY, iWidth, iHeight;

View File

@ -201,7 +201,7 @@ WXLRESULT CRenderFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPa
{ {
case SC_SCREENSAVE: case SC_SCREENSAVE:
case SC_MONITORPOWER: case SC_MONITORPOWER:
if (Core::GetState() == Core::CORE_RUN) if (Core::GetState() == Core::CORE_RUN && SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
break; break;
default: default:
return wxFrame::MSWWindowProc(nMsg, wParam, lParam); return wxFrame::MSWWindowProc(nMsg, wParam, lParam);

View File

@ -950,6 +950,7 @@ void CFrame::StartGame(const std::string& filename)
else else
{ {
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_X11) && HAVE_X11
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()), X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
X11Utils::XWindowFromHandle(GetHandle()), true); X11Utils::XWindowFromHandle(GetHandle()), true);
#endif #endif
@ -1070,6 +1071,7 @@ void CFrame::DoStop()
wxEndBusyCursor(); wxEndBusyCursor();
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_X11) && HAVE_X11
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()), X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
X11Utils::XWindowFromHandle(GetHandle()), false); X11Utils::XWindowFromHandle(GetHandle()), false);
#endif #endif

View File

@ -146,7 +146,8 @@ void X11_MainLoop()
Window win = (Window)Core::GetWindowHandle(); Window win = (Window)Core::GetWindowHandle();
XSelectInput(dpy, win, KeyPressMask | FocusChangeMask); 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 #if defined(HAVE_XRANDR) && HAVE_XRANDR
X11Utils::XRRConfiguration *XRRConfig = new X11Utils::XRRConfiguration(dpy, win); X11Utils::XRRConfiguration *XRRConfig = new X11Utils::XRRConfiguration(dpy, win);
@ -258,8 +259,8 @@ void X11_MainLoop()
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
delete XRRConfig; delete XRRConfig;
#endif #endif
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
X11Utils::InhibitScreensaver(dpy, win, false); X11Utils::InhibitScreensaver(dpy, win, false);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XFreeCursor(dpy, blankCursor); XFreeCursor(dpy, blankCursor);

View File

@ -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 // Called when a screensaver wants to show up while this window is active
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
switch (wParam) switch (wParam)
{ {
case SC_SCREENSAVE: case SC_SCREENSAVE:
case SC_MONITORPOWER: case SC_MONITORPOWER:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
break; break;
default: default:
return DefWindowProc(hWnd, iMsg, wParam, lParam); return DefWindowProc(hWnd, iMsg, wParam, lParam);