Cocoa: send a MOUSEMOTION event when warping cursor from outside the window.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 31 May 2015 13:58:36 -0400
changeset 9691c0ca56ba6749
parent 9690 eb38e9960b05
child 9692 1982dc994254
Cocoa: send a MOUSEMOTION event when warping cursor from outside the window.

Fixes Bugzilla #2984.
src/video/cocoa/SDL_cocoamouse.m
     1.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Sun May 31 19:23:16 2015 +0200
     1.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Sun May 31 13:58:36 2015 -0400
     1.3 @@ -230,6 +230,10 @@
     1.4  static void
     1.5  Cocoa_WarpMouse(SDL_Window * window, int x, int y)
     1.6  {
     1.7 +    /* pretend we have the mouse focus, even if we don't, so
     1.8 +        Cocoa_WarpMouseGlobal() will properly fake a mouse motion event. */
     1.9 +    SDL_Mouse *mouse = SDL_GetMouse();
    1.10 +    mouse->focus = window;
    1.11      Cocoa_WarpMouseGlobal(x + window->x, y + window->y);
    1.12  }
    1.13