comparison src/video/x11/SDL_x11events.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 409974dedf2e
children b966761fef6c
comparison
equal deleted inserted replaced
3935:00959c391aa6 3936:c5c3c772f5aa
1134 #else 1134 #else
1135 *dpms = 0; 1135 *dpms = 0;
1136 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ 1136 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */
1137 } 1137 }
1138 1138
1139 void X11_DisableScreenSaver(Display *display) 1139 void X11_DisableScreenSaver(_THIS, Display *display)
1140 { 1140 {
1141 int timeout, interval, prefer_blank, allow_exp; 1141 int timeout, interval, prefer_blank, allow_exp;
1142
1143 if (this->hidden->allow_screensaver) {
1144 return;
1145 }
1146
1142 XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp); 1147 XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp);
1143 timeout = 0; 1148 timeout = 0;
1144 XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp); 1149 XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp);
1145 1150
1146 #if SDL_VIDEO_DRIVER_X11_DPMS 1151 #if SDL_VIDEO_DRIVER_X11_DPMS
1151 } 1156 }
1152 } 1157 }
1153 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ 1158 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */
1154 } 1159 }
1155 1160
1156 void X11_RestoreScreenSaver(Display *display, int saved_timeout, BOOL dpms) 1161 void X11_RestoreScreenSaver(_THIS, Display *display, int saved_timeout, BOOL dpms)
1157 { 1162 {
1158 int timeout, interval, prefer_blank, allow_exp; 1163 int timeout, interval, prefer_blank, allow_exp;
1164
1165 if (this->hidden->allow_screensaver) {
1166 return;
1167 }
1168
1159 XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp); 1169 XGetScreenSaver(display, &timeout, &interval, &prefer_blank, &allow_exp);
1160 timeout = saved_timeout; 1170 timeout = saved_timeout;
1161 XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp); 1171 XSetScreenSaver(display, timeout, interval, prefer_blank, allow_exp);
1162 1172
1163 #if SDL_VIDEO_DRIVER_X11_DPMS 1173 #if SDL_VIDEO_DRIVER_X11_DPMS