summaryrefslogtreecommitdiff
path: root/src/utils/sdl2helper.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-13 01:57:39 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-13 01:57:39 +0300
commit10f73a88a374a250d192b02d783b5de3fe6e4aa6 (patch)
treebc7168fc5fbeeb68470d4245c7319c5a1098b554 /src/utils/sdl2helper.cpp
parent1f71a98b9377324bb08ba20fbfe52cbff67c49c9 (diff)
downloadmv-10f73a88a374a250d192b02d783b5de3fe6e4aa6.tar.gz
mv-10f73a88a374a250d192b02d783b5de3fe6e4aa6.tar.bz2
mv-10f73a88a374a250d192b02d783b5de3fe6e4aa6.tar.xz
mv-10f73a88a374a250d192b02d783b5de3fe6e4aa6.zip
Fix option for enable/disable screensaver in SDL 2.
Diffstat (limited to 'src/utils/sdl2helper.cpp')
-rw-r--r--src/utils/sdl2helper.cpp15
1 files changed, 15 insertions, 0 deletions
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 <SDL_events.h>
+#include <SDL_hints.h>
#include <SDL_syswm.h>
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