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 619 bf816ce70144
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
--- a/src/video/quartz/SDL_QuartzEvents.m	Sat May 03 19:48:37 2003 +0000
+++ b/src/video/quartz/SDL_QuartzEvents.m	Thu May 22 06:28:40 2003 +0000
@@ -389,6 +389,15 @@
     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 ];