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 6301e8a69c5378e7
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
     1.1 --- a/src/events/SDL_mouse.c	Fri Feb 03 23:08:48 2012 +1300
     1.2 +++ b/src/events/SDL_mouse.c	Fri Feb 03 23:53:51 2012 +1300
     1.3 @@ -465,7 +465,11 @@
     1.4          }
     1.5          mouse->cur_cursor = cursor;
     1.6      } else {
     1.7 -        cursor = mouse->cur_cursor;
     1.8 +        if (mouse->focus) {
     1.9 +            cursor = mouse->cur_cursor;
    1.10 +        } else {
    1.11 +            cursor = mouse->def_cursor;
    1.12 +        }
    1.13      }
    1.14  
    1.15      if (cursor && mouse->cursor_shown && !mouse->relative_mode) {
     2.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Fri Feb 03 23:08:48 2012 +1300
     2.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Fri Feb 03 23:53:51 2012 +1300
     2.3 @@ -92,15 +92,13 @@
     2.4  {
     2.5      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     2.6  
     2.7 -    if (SDL_GetMouseFocus()) {
     2.8 -        if (cursor) {
     2.9 -            NSCursor *nscursor = (NSCursor *)cursor->driverdata;
    2.10 +    if (cursor) {
    2.11 +        NSCursor *nscursor = (NSCursor *)cursor->driverdata;
    2.12  
    2.13 -            [nscursor set];
    2.14 -            [NSCursor unhide];
    2.15 -        } else {
    2.16 -            [NSCursor hide];
    2.17 -        }
    2.18 +        [nscursor set];
    2.19 +        [NSCursor unhide];
    2.20 +    } else {
    2.21 +        [NSCursor hide];
    2.22      }
    2.23  
    2.24      [pool release];
     3.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Fri Feb 03 23:08:48 2012 +1300
     3.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Fri Feb 03 23:53:51 2012 +1300
     3.3 @@ -313,9 +313,7 @@
     3.4              CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
     3.5          } else {
     3.6              SDL_SetMouseFocus(NULL);
     3.7 -
     3.8 -            [[NSCursor arrowCursor] set];
     3.9 -            [NSCursor unhide];
    3.10 +            SDL_SetCursor(NULL);
    3.11          }
    3.12      }
    3.13  }