Skip to content

Commit

Permalink
Mac: Don't disassociate cursor if window is moving / doesn't have focus.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenpt committed Feb 27, 2014
1 parent 4850d25 commit dd94c5f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/video/cocoa/SDL_cocoamouse.m
Expand Up @@ -244,8 +244,23 @@ + (NSCursor *)invisibleCursor
static int
Cocoa_SetRelativeMouseMode(SDL_bool enabled)
{
CGError result;
/* We will re-apply the relative mode when the window gets focus, if it
* doesn't have focus right now.
*/
SDL_Window *window = SDL_GetMouseFocus();
if (!window) {
return 0;
}

/* We will re-apply the relative mode when the window finishes being moved,
* if it is being moved right now.
*/
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
if ([data->listener isMoving]) {
return;
}

CGError result;
if (enabled) {
DLog("Turning on.");
result = CGAssociateMouseAndMouseCursorPosition(NO);
Expand Down

0 comments on commit dd94c5f

Please sign in to comment.