Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Mac: Update mouse position on warp.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenpt committed Apr 24, 2013
1 parent 479b642 commit 06f0751
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/video/cocoa/SDL_cocoamouse.m
Expand Up @@ -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
Expand Down

0 comments on commit 06f0751

Please sign in to comment.