Mac: Update mouse position on warp.
authorJørgen P. Tjernø <jorgen@valvesoftware.com>
Wed, 24 Apr 2013 12:20:48 -0700
changeset 7106 31f8acac196b
parent 7105 0de0f099cfd6
child 7107 2fcf7bf1d2b2
Mac: Update mouse position on warp.
src/video/cocoa/SDL_cocoamouse.m
--- a/src/video/cocoa/SDL_cocoamouse.m	Wed Apr 24 12:20:44 2013 -0700
+++ b/src/video/cocoa/SDL_cocoamouse.m	Wed Apr 24 12:20:48 2013 -0700
@@ -187,11 +187,17 @@
 static void
 Cocoa_WarpMouse(SDL_Window * window, int x, int y)
 {
+    SDL_Mouse *mouse = SDL_GetMouse();
     CGPoint point;
 
     point.x = (float)window->x + x;
     point.y = (float)window->y + y;
     CGWarpMouseCursorPosition(point);
+
+    /* CGWarpMouseCursorPosition doesn't generate a window event, unlike our
+     * other implementations' APIs.
+     */
+    SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y);
 }
 
 static int