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

Commit

Permalink
Update the cursor correctly when it enters and leaves the window.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 22, 2011
1 parent defaea7 commit 7b52d16
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -255,15 +255,12 @@ - (void)mouseEntered:(NSEvent *)theEvent

SDL_SetMouseFocus(_data->window);

if (!mouse->cursor_shown) {
[NSCursor hide];
}
SDL_SetCursor(NULL);
}

- (void)mouseExited:(NSEvent *)theEvent
{
SDL_Window *window = _data->window;
SDL_Mouse *mouse = SDL_GetMouse();

if (SDL_GetMouseFocus() == window) {
if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
Expand All @@ -281,11 +278,10 @@ - (void)mouseExited:(NSEvent *)theEvent
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
} else {
SDL_SetMouseFocus(NULL);
}
}

if (!mouse->cursor_shown) {
[NSCursor unhide];
[[NSCursor arrowCursor] set];
[NSCursor unhide];
}
}
}

Expand Down

0 comments on commit 7b52d16

Please sign in to comment.