| Summary: | Cursor doesn't update properly on alt-tab | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Alex Szpakowski <amaranth72> |
| Component: | events | Assignee: | (disabled) Jørgen Tjernø <jorgen> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | minor | ||
| Priority: | P2 | CC: | jorgen |
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Mac OS X 10.7 | ||
| Attachments: | Small program for testing the cursor bug | ||
I'm able to reproduce this on Mac with the code you provided (not tested on other platforms) This is probably caused by calling -[NSCursor set] on OSX when we get the windowDidBecomeKey: notification, which doesn't work. Fixes include: - Switch to using cursor rects (patch for 1.2's Quartz video backend is here http://hg.libsdl.org/SDL/rev/b8f2db95145e) - Schedule the 'set' call to be called in the event loop in a short a timespan as possible. I also notice that we do +[NSCursor hide] and +[NSCursor unhide] without regard for balancing them. According to the docs, each hide has to be matched with one unhide. We should probably fix that too. Should be fixed in http://hg.libsdl.org/SDL/rev/ffd910de700b - please reopen if it hasn't been. |
Created attachment 1106 [details] Small program for testing the cursor bug If I have a custom cursor set, and my cursor is inside an SDL2 window and I alt/cmd-tab to a different program, the cursor will revert to the default system cursor as expected. However, if I alt/cmd-tab back into the SDL program with the cursor position inside the window bounds, SDL_WINDOWEVENT_ENTER will trigger correctly, but the cursor will not be set to the expected custom one until I move it completely out of the SDL window and back in (triggering a second SDL_WINDOWEVENT_ENTER). I've been able to work around this bug by explicitly forcing a cursor update (calling SDL_SetCursor(NULL)) when SDL_WINDOWEVENT_ENTER is triggered, but that's just a workaround. I have only tested this on Mac OS 10.8.3 so I don't know if it's an OS-specific issue.