Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Change SDL_SetCursor to set the cursor back to the default cursor whe…

…n the

window is unfocused.
  • Loading branch information
Nemo157 committed Feb 3, 2012
1 parent 079c188 commit 44341d3b7806e95bbcc9ffb167b428259c2ac9e6
Showing with 12 additions and 12 deletions.
  1. +5 −1 src/events/SDL_mouse.c
  2. +6 −8 src/video/cocoa/SDL_cocoamouse.m
  3. +1 −3 src/video/cocoa/SDL_cocoawindow.m
@@ -465,7 +465,11 @@ SDL_SetCursor(SDL_Cursor * cursor)
}
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) {
@@ -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];
@@ -313,9 +313,7 @@ - (void)mouseExited:(NSEvent *)theEvent
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
} else {
SDL_SetMouseFocus(NULL);

[[NSCursor arrowCursor] set];
[NSCursor unhide];
SDL_SetCursor(NULL);
}
}
}

0 comments on commit 44341d3

Please sign in to comment.