src/SDL_compat.c
changeset 3025 54fac87e1f34
parent 2967 e4a469d6ddab
child 3028 1c4a059966bd
--- a/src/SDL_compat.c	Sun Jan 11 23:56:19 2009 +0000
+++ b/src/SDL_compat.c	Mon Jan 12 06:19:05 2009 +0000
@@ -376,6 +376,26 @@
     SDL_UpdateRect(SDL_PublicSurface, 0, 0, 0, 0);
 }
 
+static void
+SetupScreenSaver()
+{
+    const char *env;
+    SDL_bool allow_screensaver;
+
+	/* Allow environment override of screensaver disable */
+	env = SDL_getenv("SDL_VIDEO_ALLOW_SCREENSAVER");
+	if (env) {
+		allow_screensaver = SDL_atoi(env) ? SDL_TRUE : SDL_FALSE;
+	} else {
+		allow_screensaver = SDL_FALSE;
+	}
+    if (allow_screensaver) {
+        SDL_EnableScreenSaver();
+    } else {
+        SDL_DisableScreenSaver();
+    }
+}
+
 int
 SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags)
 {
@@ -456,6 +476,7 @@
 {
     SDL_DisplayMode desktop_mode;
     SDL_DisplayMode mode;
+    const char *env;
     int window_x = SDL_WINDOWPOS_UNDEFINED;
     int window_y = SDL_WINDOWPOS_UNDEFINED;
     Uint32 window_flags;
@@ -679,6 +700,8 @@
 
     ClearVideoSurface();
 
+    SetupScreenSaver();
+
     /* We're finally done! */
     return SDL_PublicSurface;
 }