Mac: avoid calling CGSetLocalEventsSuppressionInterval, it was deprecated in OS X 10.6.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m
index c768331..82bdc48 100644
--- a/src/video/cocoa/SDL_cocoamouse.m
+++ b/src/video/cocoa/SDL_cocoamouse.m
@@ -226,13 +226,15 @@ Cocoa_WarpMouseGlobal(int x, int y)
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.
diff --git a/src/video/cocoa/SDL_cocoamousetap.m b/src/video/cocoa/SDL_cocoamousetap.m
index ed70f3c..0f29daf 100644
--- a/src/video/cocoa/SDL_cocoamousetap.m
+++ b/src/video/cocoa/SDL_cocoamousetap.m
@@ -115,9 +115,8 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event
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