Disable MacOS X screensaver for duration of application run by triggering a
authorRyan C. Gordon <icculus@icculus.org>
Thu, 22 May 2003 06:28:40 +0000
changeset 619bf816ce70144
parent 618 707748c422f8
child 620 92080b127f82
Disable MacOS X screensaver for duration of application run by triggering a
"UsrActivity" alert every five seconds in the Quartz PumpEvents implementation.
src/video/quartz/SDL_QuartzEvents.m
     1.1 --- a/src/video/quartz/SDL_QuartzEvents.m	Sat May 03 19:48:37 2003 +0000
     1.2 +++ b/src/video/quartz/SDL_QuartzEvents.m	Thu May 22 06:28:40 2003 +0000
     1.3 @@ -389,6 +389,15 @@
     1.4      NSRect titleBarRect;
     1.5      NSAutoreleasePool *pool;
     1.6  
     1.7 +    /* Update activity every five seconds to prevent screensaver. --ryan. */
     1.8 +    static Uint32 screensaverTicks = 0;
     1.9 +    Uint32 nowTicks = SDL_GetTicks();
    1.10 +    if ((nowTicks - screensaverTicks) > 5000)
    1.11 +    {
    1.12 +        UpdateSystemActivity(UsrActivity);
    1.13 +        screensaverTicks = nowTicks;
    1.14 +    }
    1.15 +
    1.16      pool = [ [ NSAutoreleasePool alloc ] init ];
    1.17      distantPast = [ NSDate distantPast ];
    1.18