Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11events.c @ 1783:c546353b1ad4
Fixed bug #203
Disable screensaver and DPMS blanking while SDL app is running.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 08 May 2006 06:38:13 +0000 |
parents | db7e15a99cb3 |
children | 45669d4efd02 |
comparison
equal
deleted
inserted
replaced
1782:23fe15f88c03 | 1783:c546353b1ad4 |
---|---|
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) | |
1122 { | |
1123 int timeout, interval, prefer_blank, allow_exp; | |
1124 XGetScreenSaver(SDL_Display, &timeout, &interval, &prefer_blank, &allow_exp); | |
1125 screensaver_timeout = timeout; | |
1126 | |
1127 #if SDL_VIDEO_DRIVER_X11_DPMS | |
1128 if ( SDL_X11_HAVE_DPMS ) { | |
1129 int dummy; | |
1130 if ( DPMSQueryExtension(SDL_Display, &dummy, &dummy) ) { | |
1131 CARD16 state; | |
1132 DPMSInfo(SDL_Display, &state, &dpms_enabled); | |
1133 } | |
1134 } | |
1135 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ | |
1136 } | |
1137 | |
1138 void X11_DisableScreenSaver(_THIS) | |
1139 { | |
1140 int timeout, interval, prefer_blank, allow_exp; | |
1141 XGetScreenSaver(SDL_Display, &timeout, &interval, &prefer_blank, &allow_exp); | |
1142 timeout = 0; | |
1143 XSetScreenSaver(SDL_Display, timeout, interval, prefer_blank, allow_exp); | |
1144 | |
1145 #if SDL_VIDEO_DRIVER_X11_DPMS | |
1146 if ( SDL_X11_HAVE_DPMS ) { | |
1147 int dummy; | |
1148 if ( DPMSQueryExtension(SDL_Display, &dummy, &dummy) ) { | |
1149 DPMSDisable(SDL_Display); | |
1150 } | |
1151 } | |
1152 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ | |
1153 } | |
1154 | |
1155 void X11_RestoreScreenSaver(_THIS) | |
1156 { | |
1157 int timeout, interval, prefer_blank, allow_exp; | |
1158 XGetScreenSaver(SDL_Display, &timeout, &interval, &prefer_blank, &allow_exp); | |
1159 timeout = screensaver_timeout; | |
1160 XSetScreenSaver(SDL_Display, timeout, interval, prefer_blank, allow_exp); | |
1161 | |
1162 #if SDL_VIDEO_DRIVER_X11_DPMS | |
1163 if ( SDL_X11_HAVE_DPMS ) { | |
1164 int dummy; | |
1165 if ( DPMSQueryExtension(SDL_Display, &dummy, &dummy) ) { | |
1166 if ( dpms_enabled ) { | |
1167 DPMSEnable(SDL_Display); | |
1168 } | |
1169 } | |
1170 } | |
1171 #endif /* SDL_VIDEO_DRIVER_X11_DPMS */ | |
1172 } |