Mercurial > sdl-ios-xcode
diff 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 |
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoaevents.m Sun Jan 11 23:56:19 2009 +0000 +++ b/src/video/cocoa/SDL_cocoaevents.m Mon Jan 12 06:19:05 2009 +0000 @@ -164,6 +164,17 @@ { NSAutoreleasePool *pool; + /* Update activity every 30 seconds to prevent screensaver */ + if (_this->suspend_screensaver) { + SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; + Uint32 now = SDL_GetTicks(); + if (!data->screensaver_activity || + (int)(now-data->screensaver_activity) >= 30000) { + UpdateSystemActivity(UsrActivity); + data->screensaver_activity = now; + } + } + pool = [[NSAutoreleasePool alloc] init]; while ([NSApp isRunning]) { NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];