[Commits] SDL: Mac: avoid calling CGSetLocalEventsSuppressionInterval, it ...

libsdl.org revision control commits-owner at libsdl.org
Sun Mar 20 11:35:59 PDT 2016


details:   https://hg.libsdl.org/SDL/rev/f0645cd8fd39
changeset: 10122:f0645cd8fd39
user:      Alex Szpakowski <slime73 at gmail.com>
date:      Sun Mar 20 15:35:34 2016 -0300
description:
Mac: avoid calling CGSetLocalEventsSuppressionInterval, it was deprecated in OS X 10.6.

diffstat:

 src/video/cocoa/SDL_cocoamouse.m    |  14 ++++++++------
 src/video/cocoa/SDL_cocoamousetap.m |   3 +--
 2 files changed, 9 insertions(+), 8 deletions(-)

diffs (39 lines):

diff -r 6b6ded44e6e0 -r f0645cd8fd39 src/video/cocoa/SDL_cocoamouse.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.
diff -r 6b6ded44e6e0 -r f0645cd8fd39 src/video/cocoa/SDL_cocoamousetap.m
--- 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


More information about the commits mailing list