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 10122f0645cd8fd39
parent 10121 6b6ded44e6e0
child 10123 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
     1.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Fri Mar 18 22:15:53 2016 -0300
     1.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Sun Mar 20 15:35:34 2016 -0300
     1.3 @@ -226,13 +226,15 @@
     1.4  
     1.5      Cocoa_HandleMouseWarp(point.x, point.y);
     1.6  
     1.7 -    /* According to the docs, this was deprecated in 10.6, but it's still
     1.8 -     * around. The substitute requires a CGEventSource, but I'm not entirely
     1.9 -     * sure how we'd procure the right one for this event.
    1.10 +    CGWarpMouseCursorPosition(point);
    1.11 +
    1.12 +    /* CGWarpMouse causes a short delay by default, which is preventable by
    1.13 +     * Calling this directly after. CGSetLocalEventsSuppressionInterval can also
    1.14 +     * prevent it, but it's deprecated as of OS X 10.6.
    1.15       */
    1.16 -    CGSetLocalEventsSuppressionInterval(0.0);
    1.17 -    CGWarpMouseCursorPosition(point);
    1.18 -    CGSetLocalEventsSuppressionInterval(0.25);
    1.19 +    if (!mouse->relative_mode) {
    1.20 +        CGAssociateMouseAndMouseCursorPosition(YES);
    1.21 +    }
    1.22  
    1.23      /* CGWarpMouseCursorPosition doesn't generate a window event, unlike our
    1.24       * other implementations' APIs. Send what's appropriate.
     2.1 --- a/src/video/cocoa/SDL_cocoamousetap.m	Fri Mar 18 22:15:53 2016 -0300
     2.2 +++ b/src/video/cocoa/SDL_cocoamousetap.m	Sun Mar 20 15:35:34 2016 -0300
     2.3 @@ -115,9 +115,8 @@
     2.4              newLocation.y += (eventLocation.y - NSMaxY(windowRect) + 1);
     2.5          }
     2.6  
     2.7 -        CGSetLocalEventsSuppressionInterval(0);
     2.8          CGWarpMouseCursorPosition(newLocation);
     2.9 -        CGSetLocalEventsSuppressionInterval(0.25);
    2.10 +        CGAssociateMouseAndMouseCursorPosition(YES);
    2.11  
    2.12          if ((CGEventMaskBit(type) & movementEventsMask) == 0) {
    2.13              /* For click events, we just constrain the event to the window, so