Mac: Update mouse position on warp.
authorJørgen P. Tjernø <jorgen@valvesoftware.com>
Wed, 24 Apr 2013 12:20:48 -0700
changeset 710631f8acac196b
parent 7105 0de0f099cfd6
child 7107 2fcf7bf1d2b2
Mac: Update mouse position on warp.
src/video/cocoa/SDL_cocoamouse.m
     1.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Wed Apr 24 12:20:44 2013 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Wed Apr 24 12:20:48 2013 -0700
     1.3 @@ -187,11 +187,17 @@
     1.4  static void
     1.5  Cocoa_WarpMouse(SDL_Window * window, int x, int y)
     1.6  {
     1.7 +    SDL_Mouse *mouse = SDL_GetMouse();
     1.8      CGPoint point;
     1.9  
    1.10      point.x = (float)window->x + x;
    1.11      point.y = (float)window->y + y;
    1.12      CGWarpMouseCursorPosition(point);
    1.13 +
    1.14 +    /* CGWarpMouseCursorPosition doesn't generate a window event, unlike our
    1.15 +     * other implementations' APIs.
    1.16 +     */
    1.17 +    SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y);
    1.18  }
    1.19  
    1.20  static int