[SDL] Sleep broken on Mac

Phil Steinmeyer psteinmeyerpublic at charter.net
Tue Nov 8 13:45:59 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.

I had the same problem on Windows, and fixed it by adding 
this line within the WinMessage function in sdl_sysevents.c :

case WM_POWERBROADCAST :  
   return DefWindowProc(hwnd, msg, wParam, lParam);

(i.e. this message was getting 'eaten' by SDL, preventing 
normal processing for power/sleep-related stuff.)

I assume something similar may be going on for the Mac, 
but I'm much less familiar with Mac's messaging stuff.  

Can anybody tell me what, if anything I can add/change 
to get it working on the Mac?







More information about the SDL mailing list