Update the cursor correctly when it enters and leaves the window.
authorSam Lantinga <slouken@libsdl.org>
Mon, 21 Feb 2011 23:45:48 -0800
changeset 5388 6e586f65f8ef
parent 5387 03c79d46bf5c
child 5389 24903690f48a
Update the cursor correctly when it enters and leaves the window.
src/video/cocoa/SDL_cocoawindow.m
--- a/src/video/cocoa/SDL_cocoawindow.m	Mon Feb 21 23:10:00 2011 -0800
+++ b/src/video/cocoa/SDL_cocoawindow.m	Mon Feb 21 23:45:48 2011 -0800
@@ -255,15 +255,12 @@
 
     SDL_SetMouseFocus(_data->window);
 
-    if (!mouse->cursor_shown) {
-        [NSCursor hide];
-    }
+    SDL_SetCursor(NULL);
 }
 
 - (void)mouseExited:(NSEvent *)theEvent
 {
     SDL_Window *window = _data->window;
-    SDL_Mouse *mouse = SDL_GetMouse();
 
     if (SDL_GetMouseFocus() == window) {
         if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
@@ -281,12 +278,11 @@
             CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
         } else {
             SDL_SetMouseFocus(NULL);
+
+            [[NSCursor arrowCursor] set];
+            [NSCursor unhide];
         }
     }
-
-    if (!mouse->cursor_shown) {
-        [NSCursor unhide];
-    }
 }
 
 - (void)mouseMoved:(NSEvent *)theEvent