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/sdl2helper.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/utils/sdl2helper.cpp') diff --git a/src/utils/sdl2helper.cpp b/src/utils/sdl2helper.cpp index 00893ce82..da86d2b41 100644 --- a/src/utils/sdl2helper.cpp +++ b/src/utils/sdl2helper.cpp @@ -31,6 +31,7 @@ PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include +#include #include PRAGMA48(GCC diagnostic pop) @@ -210,4 +211,18 @@ bool SDL::PollEvent(SDL_Event *event) SDL_LASTEVENT) > 0; } +void SDL::allowScreenSaver(const bool allow) +{ + if (allow) + { + SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1"); + SDL_EnableScreenSaver(); + } + else + { + SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "0"); + SDL_DisableScreenSaver(); + } +} + #endif // USE_SDL2 -- cgit v1.2.3-60-g2f50