diff src/video/x11/SDL_x11video.c @ 3936:c5c3c772f5aa SDL-1.2

Let app set SDL_VIDEO_ALLOW_SCREENSAVER environment variable to override SDL's attempt to disable screen savers. Works for Quartz (Mac OS X) and X11. Need a formal API for this in 1.3, still. Fixes Bugzilla #415.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 06 Apr 2007 20:30:41 +0000
parents a10bddfdc40f
children 3dc92ff218dd
line wrap: on
line diff
--- a/src/video/x11/SDL_x11video.c	Wed Apr 04 10:34:42 2007 +0000
+++ b/src/video/x11/SDL_x11video.c	Fri Apr 06 20:30:41 2007 +0000
@@ -441,6 +441,7 @@
 
 static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat)
 {
+	const char *env = NULL;
 	char *display;
 	int i;
 
@@ -546,7 +547,7 @@
 
 	/* Save DPMS and screensaver settings */
 	X11_SaveScreenSaver(SDL_Display, &screensaver_timeout, &dpms_enabled);
-	X11_DisableScreenSaver(SDL_Display);
+	X11_DisableScreenSaver(this, SDL_Display);
 
 	/* See if we have been passed a window to use */
 	SDL_windowid = SDL_getenv("SDL_WINDOWID");
@@ -562,6 +563,10 @@
 	/* Fill in some window manager capabilities */
 	this->info.wm_available = 1;
 
+	/* Allow environment override of screensaver disable. */
+	env = SDL_getenv("SDL_VIDEO_ALLOW_SCREENSAVER");
+	this->hidden->allow_screensaver = ( (env && SDL_atoi(env)) ? 1 : 0 );
+
 	/* We're done! */
 	XFlush(SDL_Display);
 	return(0);
@@ -1375,7 +1380,7 @@
 		}
 
 		/* Restore DPMS and screensaver settings */
-		X11_RestoreScreenSaver(SDL_Display, screensaver_timeout, dpms_enabled);
+		X11_RestoreScreenSaver(this, SDL_Display, screensaver_timeout, dpms_enabled);
 
 		/* Free that blank cursor */
 		if ( SDL_BlankCursor != NULL ) {