Mac: avoid calling CGSetLocalEventsSuppressionInterval, it was deprecated in OS X 10.6.
authorAlex Szpakowski <slime73@gmail.com>
Sun, 20 Mar 2016 15:35:34 -0300
changeset 10122 f0645cd8fd39
parent 10121 6b6ded44e6e0
child 10126 d2686deec646
Mac: avoid calling CGSetLocalEventsSuppressionInterval, it was deprecated in OS X 10.6.
src/video/cocoa/SDL_cocoamouse.m
src/video/cocoa/SDL_cocoamousetap.m
--- a/src/video/cocoa/SDL_cocoamouse.m	Fri Mar 18 22:15:53 2016 -0300
+++ b/src/video/cocoa/SDL_cocoamouse.m	Sun Mar 20 15:35:34 2016 -0300
@@ -226,13 +226,15 @@
 
     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.
+    CGWarpMouseCursorPosition(point);
+
+    /* 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.
      */
-    CGSetLocalEventsSuppressionInterval(0.0);
-    CGWarpMouseCursorPosition(point);
-    CGSetLocalEventsSuppressionInterval(0.25);
+    if (!mouse->relative_mode) {
+        CGAssociateMouseAndMouseCursorPosition(YES);
+    }
 
     /* CGWarpMouseCursorPosition doesn't generate a window event, unlike our
      * other implementations' APIs. Send what's appropriate.
--- a/src/video/cocoa/SDL_cocoamousetap.m	Fri Mar 18 22:15:53 2016 -0300
+++ b/src/video/cocoa/SDL_cocoamousetap.m	Sun Mar 20 15:35:34 2016 -0300
@@ -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