Skip to content
Permalink
Browse files

Mac: Don't disassociate cursor if window is moving / doesn't have focus.

  • Loading branch information
jorgenpt committed Feb 27, 2014
1 parent 4850d25 commit dd94c5fa545d4fa2e8d80d70ab8f9e47b7a41840
Showing with 16 additions and 1 deletion.
  1. +16 −1 src/video/cocoa/SDL_cocoamouse.m
@@ -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);

0 comments on commit dd94c5f

Please sign in to comment.