Mac: Update mouse position on warp.
This commit is contained in:
parent
192af6485f
commit
238eacc409
1 changed files with 6 additions and 0 deletions
|
@ -187,11 +187,17 @@ Cocoa_ShowCursor(SDL_Cursor * cursor)
|
||||||
static void
|
static void
|
||||||
Cocoa_WarpMouse(SDL_Window * window, int x, int y)
|
Cocoa_WarpMouse(SDL_Window * window, int x, int y)
|
||||||
{
|
{
|
||||||
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
CGPoint point;
|
CGPoint point;
|
||||||
|
|
||||||
point.x = (float)window->x + x;
|
point.x = (float)window->x + x;
|
||||||
point.y = (float)window->y + y;
|
point.y = (float)window->y + y;
|
||||||
CGWarpMouseCursorPosition(point);
|
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
|
static int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue