Mac: Don't supress mousemoves after warp.

By default, synthesizing events supresses real events for a quarter
second. This makes for some wonky behavior.

--HG--
extra : histedit_source : 769156e3eba77c601de006c5aad1cdc1febe1d6c
This commit is contained in:
Jørgen P. Tjernø 2013-04-25 18:40:22 -07:00
parent 51619c5485
commit 22358fddd1
2 changed files with 12 additions and 5 deletions

View file

@ -192,7 +192,14 @@ Cocoa_WarpMouse(SDL_Window * window, int x, int y)
point.x = (float)window->x + x;
point.y = (float)window->y + y;
/* According to the docs, this was deprecated in 10.6, but it's still
* around. The substitute requires a CGEventSource, but I'm not entirely
* sure how we'd procure the right one for this event.
*/
CGSetLocalEventsSuppressionInterval(0.0);
CGWarpMouseCursorPosition(point);
CGSetLocalEventsSuppressionInterval(0.25);
/* CGWarpMouseCursorPosition doesn't generate a window event, unlike our
* other implementations' APIs.

View file

@ -393,13 +393,13 @@ static __inline__ void ConvertNSRect(NSRect *r)
cgpoint.x = window->x + x;
cgpoint.y = window->y + y;
/* We have to disassociate the curosr & the mouse before issuing
* this cursor warp, otherwise it gets limited to one update per
* 250ms, and looks very choppy.
/* According to the docs, this was deprecated in 10.6, but it's still
* around. The substitute requires a CGEventSource, but I'm not entirely
* sure how we'd procure the right one for this event.
*/
CGAssociateMouseAndMouseCursorPosition(NO);
CGSetLocalEventsSuppressionInterval(0.0);
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
CGAssociateMouseAndMouseCursorPosition(YES);
CGSetLocalEventsSuppressionInterval(0.25);
}
}
SDL_SendMouseMotion(window, 0, 0, x, y);