From 10f73a88a374a250d192b02d783b5de3fe6e4aa6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 13 Sep 2017 01:57:39 +0300 Subject: Fix option for enable/disable screensaver in SDL 2. --- src/utils/sdlhelper.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/utils/sdlhelper.cpp') diff --git a/src/utils/sdlhelper.cpp b/src/utils/sdlhelper.cpp index 85606f7f7..e30bdebaa 100644 --- a/src/utils/sdlhelper.cpp +++ b/src/utils/sdlhelper.cpp @@ -25,6 +25,7 @@ #include "logger.h" #include "utils/cast.h" +#include "utils/env.h" #include "utils/stringutils.h" #if defined(USE_X11) && defined(USE_OPENGL) @@ -205,4 +206,12 @@ bool SDL::PollEvent(SDL_Event *event) SDL_ALLEVENTS) > 0; } +void SDL::allowScreenSaver(const bool allow) +{ + if (allow) + setEnv("SDL_VIDEO_ALLOW_SCREENSAVER", "1"); + else + setEnv("SDL_VIDEO_ALLOW_SCREENSAVER", "0"); +} + #endif // USE_SDL2 -- cgit v1.2.3-60-g2f50