[SDL] Sleep broken on Mac

Ryan C. Gordon icculus at clutteredmind.org
Tue Nov 8 15:35:36 PST 2005

> I've noticed that when my SDL app is running on the Mac, the 
> Mac will NOT go to sleep.  Shut down the app, wait long 
> enough, and it WILL sleep - so the SDL app definitely 
> seems to be the cause.

Technically it's not "broken"...it's that we don't want the screensaver
to trigger when a game is running.

If you want to disable this, chop the following code out of
QZ_PumpEvents() in SDL12/src/video/quartz/SDL_QuartzEvents.m ...

/* Update activity every five seconds to prevent screensaver. --ryan. */
static Uint32 screensaverTicks = 0;
Uint32 nowTicks = SDL_GetTicks();
if ((nowTicks - screensaverTicks) > 5000)
    screensaverTicks = nowTicks;


More information about the SDL mailing list