mirror of
https://github.com/yawut/SDL.git
synced 2026-08-01 07:53:54 -05:00
Mac: Fix unmatched hide/show cursor calls.
This tracks the previous hide/unhide state of the cursor, so we don't re-hide a hidden cursor.
This commit is contained in:
parent
733eb53c6f
commit
c62b60671d
|
|
@ -153,15 +153,24 @@ Cocoa_FreeCursor(SDL_Cursor * cursor)
|
|||
static int
|
||||
Cocoa_ShowCursor(SDL_Cursor * cursor)
|
||||
{
|
||||
/* We need to track the previous state because hide and unhide calls need to
|
||||
* be matched, but ShowCursor calls don't.
|
||||
*/
|
||||
static SDL_bool isShown = SDL_TRUE;
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (cursor) {
|
||||
NSCursor *nscursor = (NSCursor *)cursor->driverdata;
|
||||
|
||||
[nscursor set];
|
||||
[NSCursor unhide];
|
||||
} else {
|
||||
[NSCursor hide];
|
||||
|
||||
if (!isShown) {
|
||||
[NSCursor unhide];
|
||||
isShown = SDL_TRUE;
|
||||
}
|
||||
} else if (isShown) {
|
||||
[NSCursor hide];
|
||||
isShown = SDL_FALSE;
|
||||
}
|
||||
|
||||
[pool release];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user