comparison src/video/x11/SDL_x11events.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 c546353b1ad4
children 01313c1a2bbe
comparison
equal deleted inserted replaced
1783:c546353b1ad4 1784:45669d4efd02
1116 void X11_InitOSKeymap(_THIS) 1116 void X11_InitOSKeymap(_THIS)
1117 { 1117 {
1118 X11_InitKeymap(); 1118 X11_InitKeymap();
1119 } 1119 }
1120 1120
1121 void X11_SaveScreenSaver(_THIS) 1121 void X11_SaveScreenSaver(Display *display, int *saved_timeout, BOOL *dpms)
1122 { 1122 {
1123 int timeout, interval, prefer_blank, allow_exp; 1123 int timeout, interval, prefer_blank, allow_exp;
1124 XGetScreenSaver(SDL_Display, &timeout, &interval, &prefer_blank, &allow_exp); 1124 XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp);
1125 screensaver_timeout = timeout; 1125 *saved_timeout = timeout;
1126 1126
1127 #if SDL_VIDEO_DRIVER_X11_DPMS 1127 #if SDL_VIDEO_DRIVER_X11_DPMS
1128 if ( SDL_X11_HAVE_DPMS ) { 1128 if ( SDL_X11_HAVE_DPMS ) {
1129 int dummy; 1129 int dummy;
1130 if ( DPMSQueryExtension(SDL_Display, &dummy, &dummy) ) { 1130 if ( DPMSQueryExtension(display, &dummy, &dummy) ) {
1131 CARD16 state; 1131 CARD16 state;
1132 DPMSInfo(SDL_Display, &state, &dpms_enabled); 1132 DPMSInfo(display, &state, dpms);
1133 } 1133 }
1134 } 1134 }
1135 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ 1135 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */
1136 } 1136 }
1137 1137
1138 void X11_DisableScreenSaver(_THIS) 1138 void X11_DisableScreenSaver(Display *display)
1139 { 1139 {
1140 int timeout, interval, prefer_blank, allow_exp; 1140 int timeout, interval, prefer_blank, allow_exp;
1141 XGetScreenSaver(SDL_Display, &timeout, &interval, &prefer_blank, &allow_exp); 1141 XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp);
1142 timeout = 0; 1142 timeout = 0;
1143 XSetScreenSaver(SDL_Display, timeout, interval, prefer_blank, allow_exp); 1143 XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp);
1144 1144
1145 #if SDL_VIDEO_DRIVER_X11_DPMS 1145 #if SDL_VIDEO_DRIVER_X11_DPMS
1146 if ( SDL_X11_HAVE_DPMS ) { 1146 if ( SDL_X11_HAVE_DPMS ) {
1147 int dummy; 1147 int dummy;
1148 if ( DPMSQueryExtension(SDL_Display, &dummy, &dummy) ) { 1148 if ( DPMSQueryExtension(display, &dummy, &dummy) ) {
1149 DPMSDisable(SDL_Display); 1149 DPMSDisable(display);
1150 } 1150 }
1151 } 1151 }
1152 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ 1152 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */
1153 } 1153 }
1154 1154
1155 void X11_RestoreScreenSaver(_THIS) 1155 void X11_RestoreScreenSaver(Display *display, int saved_timeout, BOOL dpms)
1156 { 1156 {
1157 int timeout, interval, prefer_blank, allow_exp; 1157 int timeout, interval, prefer_blank, allow_exp;
1158 XGetScreenSaver(SDL_Display, &timeout, &interval, &prefer_blank, &allow_exp); 1158 XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp);
1159 timeout = screensaver_timeout; 1159 timeout = saved_timeout;
1160 XSetScreenSaver(SDL_Display, timeout, interval, prefer_blank, allow_exp); 1160 XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp);
1161 1161
1162 #if SDL_VIDEO_DRIVER_X11_DPMS 1162 #if SDL_VIDEO_DRIVER_X11_DPMS
1163 if ( SDL_X11_HAVE_DPMS ) { 1163 if ( SDL_X11_HAVE_DPMS ) {
1164 int dummy; 1164 int dummy;
1165 if ( DPMSQueryExtension(SDL_Display, &dummy, &dummy) ) { 1165 if ( DPMSQueryExtension(display, &dummy, &dummy) ) {
1166 if ( dpms_enabled ) { 1166 if ( dpms ) {
1167 DPMSEnable(SDL_Display); 1167 DPMSEnable(display);
1168 } 1168 }
1169 } 1169 }
1170 } 1170 }
1171 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ 1171 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */
1172 } 1172 }