diff src/video/SDL_video.c @ 3025:54fac87e1f34

Added an API to enable/disable the screen saver. The screensaver is disabled by default when using SDL 1.2 compatibility. Use the new XScreenSaver extension, removed unused DPMS extension.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 12 Jan 2009 06:19:05 +0000
parents b2025ca5d7a5
children 89f8a72e1ee9
line wrap: on
line diff
--- a/src/video/SDL_video.c	Sun Jan 11 23:56:19 2009 +0000
+++ b/src/video/SDL_video.c	Mon Jan 12 06:19:05 2009 +0000
@@ -2326,6 +2326,45 @@
     }
 }
 
+SDL_bool
+SDL_IsScreenSaverEnabled()
+{
+    if (!_this) {
+        return SDL_TRUE;
+    }
+    return _this->suspend_screensaver ? SDL_FALSE : SDL_TRUE;
+}
+
+void
+SDL_EnableScreenSaver()
+{
+    if (!_this) {
+        return;
+    }
+    if (!_this->suspend_screensaver) {
+        return;
+    }
+    _this->suspend_screensaver = SDL_FALSE;
+    if (_this->SuspendScreenSaver) {
+        _this->SuspendScreenSaver(_this);
+    }
+}
+
+void
+SDL_DisableScreenSaver()
+{
+    if (!_this) {
+        return;
+    }
+    if (_this->suspend_screensaver) {
+        return;
+    }
+    _this->suspend_screensaver = SDL_TRUE;
+    if (_this->SuspendScreenSaver) {
+        _this->SuspendScreenSaver(_this);
+    }
+}
+
 void
 SDL_VideoQuit(void)
 {