mirror of
https://github.com/yawut/SDL.git
synced 2026-08-28 03:34:44 -05:00
Disable MacOS X screensaver for duration of application run by triggering a
"UsrActivity" alert every five seconds in the Quartz PumpEvents implementation.
This commit is contained in:
@@ -389,6 +389,15 @@ static void QZ_PumpEvents (_THIS)
|
||||
NSRect titleBarRect;
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
/* Update activity every five seconds to prevent screensaver. --ryan. */
|
||||
static Uint32 screensaverTicks = 0;
|
||||
Uint32 nowTicks = SDL_GetTicks();
|
||||
if ((nowTicks - screensaverTicks) > 5000)
|
||||
{
|
||||
UpdateSystemActivity(UsrActivity);
|
||||
screensaverTicks = nowTicks;
|
||||
}
|
||||
|
||||
pool = [ [ NSAutoreleasePool alloc ] init ];
|
||||
distantPast = [ NSDate distantPast ];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user