diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index b5bb895f3c..bc59076080 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -20,7 +20,6 @@ #include "RageSurface.h" #include "RageSurfaceUtils.h" -#include "PrefsManager.h" // XXX #include "ScreenDimensions.h" // XXX /* Windows's broken gl.h defines GL_EXT_paletted_texture incompletely: */ @@ -46,6 +45,7 @@ #include "RageMath.h" #include "RageTypes.h" #include "RageUtil.h" +#include "EnumHelper.h" #include "ProductInfo.h" #include "arch/LowLevelWindow/LowLevelWindow.h" @@ -444,10 +444,6 @@ CString RageDisplay_OGL::Init( VideoModeParams p, bool bAllowUnacceleratedRender return CString(); } -#if defined(UNIX) && defined(HAVE_LIBXTST) -#include -#endif - RageDisplay_OGL::~RageDisplay_OGL() { delete g_pWind; @@ -693,40 +689,6 @@ void RageDisplay_OGL::EndFrame() g_pWind->Update(); - if( PREFSMAN->m_bDisableScreenSaver ) - { - /* Disable the screensaver. */ -#if defined(UNIX) && defined(HAVE_LIBXTST) - ASSERT( g_X11Display ); - - /* This causes flicker. */ - // XForceScreenSaver( g_X11Display, ScreenSaverReset ); - - /* - * Instead, send a null relative mouse motion, to trick X into thinking there has been - * user activity. - * - * This also handles XScreenSaver; XForceScreenSaver only handles the internal X11 - * screen blanker. - * - * This will delay the X blanker, DPMS and XScreenSaver from activating, and will - * disable the blanker and XScreenSaver if they're already active (unless XSS is - * locked). For some reason, it doesn't un-blank DPMS if it's already active. - */ - - XLockDisplay( g_X11Display ); - - int event_base, error_base, major, minor; - if( XTestQueryExtension( g_X11Display, &event_base, &error_base, &major, &minor ) ) - { - XTestFakeRelativeMotionEvent( g_X11Display, 0, 0, 0 ); - XSync( g_X11Display, False ); - } - - XUnlockDisplay( g_X11Display ); -#endif - } - RageDisplay::EndFrame(); } diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp index 79128668d9..a0bd96f9a8 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp @@ -3,6 +3,7 @@ #include "RageLog.h" #include "RageException.h" #include "archutils/Unix/X11Helper.h" +#include "PrefsManager.h" // XXX #include #include // ceil() @@ -10,6 +11,10 @@ #include // All sorts of stuff... #include +#if defined(HAVE_LIBXTST) +#include +#endif + extern Display *g_X11Display; LowLevelWindow_X11::LowLevelWindow_X11() @@ -190,6 +195,38 @@ bool LowLevelWindow_X11::IsSoftwareRenderer( CString &sError ) void LowLevelWindow_X11::SwapBuffers() { glXSwapBuffers( X11Helper::Dpy, X11Helper::Win ); + + if( PREFSMAN->m_bDisableScreenSaver ) + { + /* Disable the screensaver. */ +#if defined(HAVE_LIBXTST) + /* This causes flicker. */ + // XForceScreenSaver( X11Helper::Dpy, ScreenSaverReset ); + + /* + * Instead, send a null relative mouse motion, to trick X into thinking there has been + * user activity. + * + * This also handles XScreenSaver; XForceScreenSaver only handles the internal X11 + * screen blanker. + * + * This will delay the X blanker, DPMS and XScreenSaver from activating, and will + * disable the blanker and XScreenSaver if they're already active (unless XSS is + * locked). For some reason, it doesn't un-blank DPMS if it's already active. + */ + + XLockDisplay( X11Helper::Dpy ); + + int event_base, error_base, major, minor; + if( XTestQueryExtension( X11Helper::Dpy, &event_base, &error_base, &major, &minor ) ) + { + XTestFakeRelativeMotionEvent( X11Helper::Dpy, 0, 0, 0 ); + XSync( X11Helper::Dpy, False ); + } + + XUnlockDisplay( X11Helper::Dpy ); +#endif + } } /*