Change SDL_SetCursor to set the cursor back to the default cursor when the
authorWim Looman <ghostunderscore@gmail.com>
Fri, 03 Feb 2012 23:53:51 +1300
changeset 6301 e8a69c5378e7
parent 6300 82f95e6af4cd
child 6302 b0ae93a5b8d6
Change SDL_SetCursor to set the cursor back to the default cursor when the window is unfocused.
src/events/SDL_mouse.c
src/video/cocoa/SDL_cocoamouse.m
src/video/cocoa/SDL_cocoawindow.m
--- a/src/events/SDL_mouse.c	Fri Feb 03 23:08:48 2012 +1300
+++ b/src/events/SDL_mouse.c	Fri Feb 03 23:53:51 2012 +1300
@@ -465,7 +465,11 @@
         }
         mouse->cur_cursor = cursor;
     } else {
-        cursor = mouse->cur_cursor;
+        if (mouse->focus) {
+            cursor = mouse->cur_cursor;
+        } else {
+            cursor = mouse->def_cursor;
+        }
     }
 
     if (cursor && mouse->cursor_shown && !mouse->relative_mode) {
--- a/src/video/cocoa/SDL_cocoamouse.m	Fri Feb 03 23:08:48 2012 +1300
+++ b/src/video/cocoa/SDL_cocoamouse.m	Fri Feb 03 23:53:51 2012 +1300
@@ -92,15 +92,13 @@
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-    if (SDL_GetMouseFocus()) {
-        if (cursor) {
-            NSCursor *nscursor = (NSCursor *)cursor->driverdata;
+    if (cursor) {
+        NSCursor *nscursor = (NSCursor *)cursor->driverdata;
 
-            [nscursor set];
-            [NSCursor unhide];
-        } else {
-            [NSCursor hide];
-        }
+        [nscursor set];
+        [NSCursor unhide];
+    } else {
+        [NSCursor hide];
     }
 
     [pool release];
--- a/src/video/cocoa/SDL_cocoawindow.m	Fri Feb 03 23:08:48 2012 +1300
+++ b/src/video/cocoa/SDL_cocoawindow.m	Fri Feb 03 23:53:51 2012 +1300
@@ -313,9 +313,7 @@
             CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
         } else {
             SDL_SetMouseFocus(NULL);
-
-            [[NSCursor arrowCursor] set];
-            [NSCursor unhide];
+            SDL_SetCursor(NULL);
         }
     }
 }