comparison src/video/cocoa/SDL_cocoaevents.m @ 3025:54fac87e1f34

Added an API to enable/disable the screen saver. The screensaver is disabled by default when using SDL 1.2 compatibility. Use the new XScreenSaver extension, removed unused DPMS extension.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 12 Jan 2009 06:19:05 +0000
parents 99210400e8b9
children 1282a042d530
comparison
equal deleted inserted replaced
3024:1a08749aebce 3025:54fac87e1f34
161 161
162 void 162 void
163 Cocoa_PumpEvents(_THIS) 163 Cocoa_PumpEvents(_THIS)
164 { 164 {
165 NSAutoreleasePool *pool; 165 NSAutoreleasePool *pool;
166
167 /* Update activity every 30 seconds to prevent screensaver */
168 if (_this->suspend_screensaver) {
169 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
170 Uint32 now = SDL_GetTicks();
171 if (!data->screensaver_activity ||
172 (int)(now-data->screensaver_activity) >= 30000) {
173 UpdateSystemActivity(UsrActivity);
174 data->screensaver_activity = now;
175 }
176 }
166 177
167 pool = [[NSAutoreleasePool alloc] init]; 178 pool = [[NSAutoreleasePool alloc] init];
168 while ([NSApp isRunning]) { 179 while ([NSApp isRunning]) {
169 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; 180 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];
170 if ( event == nil ) { 181 if ( event == nil ) {