//depending on how it's compiled, SDL periodically calls XResetScreenSaver when it's fullscreen
//this might bring the monitor out of standby, so we have to disable it explicitly
//by passing 0 for overwrite to setsenv, the user can still override this by setting the environment variable
+#if defined(_LINUX) && !defined(__APPLE__)
setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
+#endif
#endif // HAS_SDL
void CApplication::CheckScreenSaverAndDPMS()
{
+#if defined(_LINUX) && !defined(__APPLE__)
+ if (!m_dpmsIsActive)
+ g_Windowing.ResetX11Screensaver();
+#endif
+
bool maybeScreensaver =
!m_dpmsIsActive && !m_bScreenSave
&& !g_guiSettings.GetString("screensaver.mode").IsEmpty();
using namespace std;
-CWinSystemX11::CWinSystemX11() : CWinSystemBase()
+CWinSystemX11::CWinSystemX11() : CWinSystemBase(), m_screensaverReset(true)
{
m_eWindowSystem = WINDOW_SYSTEM_X11;
m_glContext = NULL;
SDL_ShowCursor(show ? 1 : 0);
}
+void CWinSystemX11::ResetX11Screensaver()
+{
+ if (m_bFullScreen)
+ {
+ //disallow the screensaver when we're fullscreen by periodically calling XResetScreenSaver(),
+ //normally SDL does this but we disable that in CApplication::Create()
+ //for some reason setting a 0 timeout with XSetScreenSaver doesn't work with gnome
+ if (!m_screensaverReset.IsRunning() || m_screensaverReset.GetElapsedSeconds() > 5.0f)
+ {
+ m_screensaverReset.StartZero();
+ XResetScreenSaver(m_dpy);
+ //need to flush the output buffer, since we don't check for events on m_dpy
+ XFlush(m_dpy);
+ }
+ }
+ else
+ {
+ m_screensaverReset.Stop();
+ }
+}
+
void CWinSystemX11::NotifyAppActiveChange(bool bActivated)
{
if (bActivated && m_bWasFullScreenBeforeMinimize && !g_graphicsContext.IsFullScreenRoot())
*
*/
#include "WinSystem.h"
+#include "utils/Stopwatch.h"
#include <GL/glx.h>
class CWinSystemX11 : public CWinSystemBase
virtual void UpdateResolutions();
virtual int GetNumScreens() { return 1; }
virtual void ShowOSMouse(bool show);
+ virtual void ResetX11Screensaver();
virtual void NotifyAppActiveChange(bool bActivated);
private:
bool IsSuitableVisual(XVisualInfo *vInfo);
+
+ CStopWatch m_screensaverReset;
};
#endif // WINDOW_SYSTEM_H