Change SDL_SetCursor to set the cursor back to the default cursor when the

window is unfocused.
This commit is contained in:
Wim Looman 2012-02-03 23:53:51 +13:00
parent 0da1c5b3ae
commit b7f2ad8ad0
3 changed files with 12 additions and 12 deletions

View file

@ -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) {

View file

@ -92,15 +92,13 @@ Cocoa_ShowCursor(SDL_Cursor * cursor)
{
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];

View file

@ -313,9 +313,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
} else {
SDL_SetMouseFocus(NULL);
[[NSCursor arrowCursor] set];
[NSCursor unhide];
SDL_SetCursor(NULL);
}
}
}