Navigation Menu

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

Commit

Permalink
Mac: Make mouse movement smooth at edge of window when grabbed.
Browse files Browse the repository at this point in the history
There's a limit of one update every 250ms when warping the mouse, and we
can work around that by disassociating the cursor & the mouse before
issuing our warp, then re-associating them.
  • Loading branch information
jorgenpt committed Apr 24, 2013
1 parent 8e89a32 commit 9ac1c60
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -392,7 +392,14 @@ - (void)mouseMoved:(NSEvent *)theEvent

cgpoint.x = window->x + x;
cgpoint.y = window->y + y;

/* We have to disassociate the curosr & the mouse before issuing
* this cursor warp, otherwise it gets limited to one update per
* 250ms, and looks very choppy.
*/
CGAssociateMouseAndMouseCursorPosition(NO);
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
CGAssociateMouseAndMouseCursorPosition(YES);
}
}
SDL_SendMouseMotion(window, 0, 0, x, y);
Expand Down

0 comments on commit 9ac1c60

Please sign in to comment.