Skip to content

Commit

Permalink
Mac: avoid calling CGSetLocalEventsSuppressionInterval, it was deprec…
Browse files Browse the repository at this point in the history
…ated in OS X 10.6.
  • Loading branch information
slime73 committed Mar 20, 2016
1 parent 2c3bf66 commit 08488e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/video/cocoa/SDL_cocoamouse.m
Expand Up @@ -226,13 +226,15 @@ + (NSCursor *)invisibleCursor

Cocoa_HandleMouseWarp(point.x, point.y);

/* According to the docs, this was deprecated in 10.6, but it's still
* around. The substitute requires a CGEventSource, but I'm not entirely
* sure how we'd procure the right one for this event.
*/
CGSetLocalEventsSuppressionInterval(0.0);
CGWarpMouseCursorPosition(point);
CGSetLocalEventsSuppressionInterval(0.25);

/* CGWarpMouse causes a short delay by default, which is preventable by
* Calling this directly after. CGSetLocalEventsSuppressionInterval can also
* prevent it, but it's deprecated as of OS X 10.6.
*/
if (!mouse->relative_mode) {
CGAssociateMouseAndMouseCursorPosition(YES);
}

/* CGWarpMouseCursorPosition doesn't generate a window event, unlike our
* other implementations' APIs. Send what's appropriate.
Expand Down
3 changes: 1 addition & 2 deletions src/video/cocoa/SDL_cocoamousetap.m
Expand Up @@ -115,9 +115,8 @@
newLocation.y += (eventLocation.y - NSMaxY(windowRect) + 1);
}

CGSetLocalEventsSuppressionInterval(0);
CGWarpMouseCursorPosition(newLocation);
CGSetLocalEventsSuppressionInterval(0.25);
CGAssociateMouseAndMouseCursorPosition(YES);

if ((CGEventMaskBit(type) & movementEventsMask) == 0) {
/* For click events, we just constrain the event to the window, so
Expand Down

0 comments on commit 08488e6

Please sign in to comment.