Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Mac: Fix unmatched hide/show cursor calls.
Browse files Browse the repository at this point in the history
This tracks the previous hide/unhide state of the cursor, so we don't
re-hide a hidden cursor.
  • Loading branch information
jorgenpt committed Apr 24, 2013
1 parent 9ac1c60 commit cb49b35
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/video/cocoa/SDL_cocoamouse.m
Expand Up @@ -153,15 +153,24 @@
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];
Expand Down

0 comments on commit cb49b35

Please sign in to comment.