Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Change SDL_SetCursor to set the cursor back to the default cursor whe…
Browse files Browse the repository at this point in the history
…n the

window is unfocused.
  • Loading branch information
Nemo157 committed Feb 3, 2012
1 parent 079c188 commit 44341d3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/events/SDL_mouse.c
Expand Up @@ -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) {
Expand Down
14 changes: 6 additions & 8 deletions src/video/cocoa/SDL_cocoamouse.m
Expand Up @@ -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];
Expand Down
4 changes: 1 addition & 3 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -313,9 +313,7 @@ - (void)mouseExited:(NSEvent *)theEvent
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
} else {
SDL_SetMouseFocus(NULL);

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

0 comments on commit 44341d3

Please sign in to comment.