Handling Alt/Cmd-Tab

This is probably a fairly uncommon problem, but I thought I’d post here on the off chance that someone might know of a solution.

I have an SDL-based application that grabs the mouse (using SDL_WM_GrabInput()) when in windowed mode. When the ‘application switcher’ window is opened (Alt-Tab in Windows, Cmd-Tab in OS X), the mouse stays ‘grabbed’, which causes the cursor to behave incorrectly while the application switcher is open.

In Windows, it’s really just a cosmetic issue. In OS X however, normally you can use the mouse to select an application from the application switcher window, but when ‘grab input’ is on, the cursor is frozen and can’t be used.

In Windows, I’m thinking it might be possible to address the problem by using system events (i.e. events of type SDL_SYSWMEVENT). It’s my understanding though that no ‘system’ events are dispatched in OS X (I’ve tried this with both SDL 1.2.x and 1.3, and it doesn’t appear that any ‘system’ events are generated in OS X).

My question is then: is there any way for the application to ‘know’ when the application switcher window has been opened in OS X so that it can respond accordingly?