From 7d048468d354bec85fc74b88e67be64f858b5a40 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: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 --HG-- extra : histedit_source : 3f150addd3b1b7bc6397aba60ccf05f9065ffb8c --- 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 @@ Cocoa_ShowCursor(SDL_Cursor * cursor) 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];