From b5717a38a75e60f56a1060a43ce0db720380bd6f Mon Sep 17 00:00:00 2001 From: "J?rgen P. Tjern?" Date: Tue, 23 Apr 2013 18:47:44 -0700 Subject: [PATCH] Mac: Fix cursor not updating when re-focusing the window. This fixes a bug where [NSCursor set] doesn't take when called in certain event handlers (like windowDidBecomeKey:). http://bugzilla.libsdl.org/show_bug.cgi?id=1795 --- src/video/cocoa/SDL_cocoamouse.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index 7dbde9dde..60f4a50e2 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -162,7 +162,13 @@ if (cursor) { NSCursor *nscursor = (NSCursor *)cursor->driverdata; - [nscursor set]; + /* We're possibly executing from an event handler where this operation + * is unsupported. This will execute it in the main Cocoa event loop + * after this returns. + */ + [nscursor performSelectorOnMainThread:@selector(set) + withObject:nil + waitUntilDone:NO]; if (!isShown) { [NSCursor unhide];