src/video/cocoa/SDL_cocoamouse.m
changeset 10122 f0645cd8fd39
parent 9998 f67cf37e9cd4
child 10159 d41acf6379f6
     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.