From 059ea2c1c64f85b95f8bfdcf1b27a6015b8c09d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20P=2E=20Tjern=C3=B8?= Date: Tue, 23 Apr 2013 18:47:41 -0700 Subject: [PATCH] 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 --- src/video/cocoa/SDL_cocoamouse.m | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index a12bde8dd..7dbde9dde 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -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];