diff src/video/dga/SDL_dgavideo.c @ 1784:45669d4efd02

Disable the screensaver in DGA mode, which is even more important than X11...
author Sam Lantinga <slouken@libsdl.org>
date Mon, 08 May 2006 06:54:20 +0000
parents 3ba88cb7eb1b
children dcec47a019e2
line wrap: on
line diff
--- a/src/video/dga/SDL_dgavideo.c	Mon May 08 06:38:13 2006 +0000
+++ b/src/video/dga/SDL_dgavideo.c	Mon May 08 06:54:20 2006 +0000
@@ -41,6 +41,11 @@
 /* get function pointers... */
 #include "../x11/SDL_x11dyn.h"
 
+/* Heheh we're using X11 event code */
+extern void X11_SaveScreenSaver(Display *display, int *saved_timeout, BOOL *dpms);
+extern void X11_DisableScreenSaver(Display *display);
+extern void X11_RestoreScreenSaver(Display *display, int saved_timeout, BOOL dpms);
+
 /* Initialization/Query functions */
 static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat);
 static SDL_Rect **DGA_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
@@ -387,6 +392,10 @@
 		return(-1);
 	}
 
+	/* Save DPMS and screensaver settings */
+	X11_SaveScreenSaver(DGA_Display, &screensaver_timeout, &dpms_enabled);
+	X11_DisableScreenSaver(DGA_Display);
+
 	/* Query for the list of available video modes */
 	modes = SDL_NAME(XDGAQueryModes)(DGA_Display, DGA_Screen, &num_modes);
 	SDL_qsort(modes, num_modes, sizeof *modes, cmpmodes);
@@ -1048,7 +1057,6 @@
 		}
 #endif /* LOCK_DGA_DISPLAY */
 
-
 		/* Clean up defined video modes */
 		for ( i=0; i<NUM_MODELISTS; ++i ) {
 			if ( SDL_modelist[i] != NULL ) {
@@ -1063,6 +1071,9 @@
 		/* Clean up the memory bucket list */
 		DGA_FreeHWSurfaces(this);
 
+		/* Restore DPMS and screensaver settings */
+		X11_RestoreScreenSaver(DGA_Display, screensaver_timeout, dpms_enabled);
+
 		/* Close up the display */
 		XCloseDisplay(DGA_Display);
 	}