Mercurial > sdl-ios-xcode
comparison 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 |
comparison
equal
deleted
inserted
replaced
1783:c546353b1ad4 | 1784:45669d4efd02 |
---|---|
38 #include "SDL_dgamouse_c.h" | 38 #include "SDL_dgamouse_c.h" |
39 #include "SDL_dgaevents_c.h" | 39 #include "SDL_dgaevents_c.h" |
40 | 40 |
41 /* get function pointers... */ | 41 /* get function pointers... */ |
42 #include "../x11/SDL_x11dyn.h" | 42 #include "../x11/SDL_x11dyn.h" |
43 | |
44 /* Heheh we're using X11 event code */ | |
45 extern void X11_SaveScreenSaver(Display *display, int *saved_timeout, BOOL *dpms); | |
46 extern void X11_DisableScreenSaver(Display *display); | |
47 extern void X11_RestoreScreenSaver(Display *display, int saved_timeout, BOOL dpms); | |
43 | 48 |
44 /* Initialization/Query functions */ | 49 /* Initialization/Query functions */ |
45 static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat); | 50 static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat); |
46 static SDL_Rect **DGA_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); | 51 static SDL_Rect **DGA_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); |
47 static SDL_Surface *DGA_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); | 52 static SDL_Surface *DGA_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); |
385 SDL_SetError("Unable to map the video memory"); | 390 SDL_SetError("Unable to map the video memory"); |
386 XCloseDisplay(DGA_Display); | 391 XCloseDisplay(DGA_Display); |
387 return(-1); | 392 return(-1); |
388 } | 393 } |
389 | 394 |
395 /* Save DPMS and screensaver settings */ | |
396 X11_SaveScreenSaver(DGA_Display, &screensaver_timeout, &dpms_enabled); | |
397 X11_DisableScreenSaver(DGA_Display); | |
398 | |
390 /* Query for the list of available video modes */ | 399 /* Query for the list of available video modes */ |
391 modes = SDL_NAME(XDGAQueryModes)(DGA_Display, DGA_Screen, &num_modes); | 400 modes = SDL_NAME(XDGAQueryModes)(DGA_Display, DGA_Screen, &num_modes); |
392 SDL_qsort(modes, num_modes, sizeof *modes, cmpmodes); | 401 SDL_qsort(modes, num_modes, sizeof *modes, cmpmodes); |
393 for ( i=0; i<num_modes; ++i ) { | 402 for ( i=0; i<num_modes; ++i ) { |
394 #ifdef DGA_DEBUG | 403 #ifdef DGA_DEBUG |
1046 SDL_DestroyMutex(event_lock); | 1055 SDL_DestroyMutex(event_lock); |
1047 event_lock = NULL; | 1056 event_lock = NULL; |
1048 } | 1057 } |
1049 #endif /* LOCK_DGA_DISPLAY */ | 1058 #endif /* LOCK_DGA_DISPLAY */ |
1050 | 1059 |
1051 | |
1052 /* Clean up defined video modes */ | 1060 /* Clean up defined video modes */ |
1053 for ( i=0; i<NUM_MODELISTS; ++i ) { | 1061 for ( i=0; i<NUM_MODELISTS; ++i ) { |
1054 if ( SDL_modelist[i] != NULL ) { | 1062 if ( SDL_modelist[i] != NULL ) { |
1055 for ( j=0; SDL_modelist[i][j]; ++j ) { | 1063 for ( j=0; SDL_modelist[i][j]; ++j ) { |
1056 SDL_free(SDL_modelist[i][j]); | 1064 SDL_free(SDL_modelist[i][j]); |
1061 } | 1069 } |
1062 | 1070 |
1063 /* Clean up the memory bucket list */ | 1071 /* Clean up the memory bucket list */ |
1064 DGA_FreeHWSurfaces(this); | 1072 DGA_FreeHWSurfaces(this); |
1065 | 1073 |
1074 /* Restore DPMS and screensaver settings */ | |
1075 X11_RestoreScreenSaver(DGA_Display, screensaver_timeout, dpms_enabled); | |
1076 | |
1066 /* Close up the display */ | 1077 /* Close up the display */ |
1067 XCloseDisplay(DGA_Display); | 1078 XCloseDisplay(DGA_Display); |
1068 } | 1079 } |
1069 } | 1080 } |