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. --HG-- extra : histedit_source : d41e30a604fb9ff0da8fcfdd9ca926618e35c750
This commit is contained in:
parent
4f88e70fe6
commit
059ea2c1c6
1 changed files with 12 additions and 3 deletions
|
@ -153,15 +153,24 @@ Cocoa_FreeCursor(SDL_Cursor * cursor)
|
||||||
static int
|
static int
|
||||||
Cocoa_ShowCursor(SDL_Cursor * cursor)
|
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];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
NSCursor *nscursor = (NSCursor *)cursor->driverdata;
|
NSCursor *nscursor = (NSCursor *)cursor->driverdata;
|
||||||
|
|
||||||
[nscursor set];
|
[nscursor set];
|
||||||
[NSCursor unhide];
|
|
||||||
} else {
|
if (!isShown) {
|
||||||
[NSCursor hide];
|
[NSCursor unhide];
|
||||||
|
isShown = SDL_TRUE;
|
||||||
|
}
|
||||||
|
} else if (isShown) {
|
||||||
|
[NSCursor hide];
|
||||||
|
isShown = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue