Quartz: Fix mouse warping freezing for 250+ milliseconds.
Fixes Bugzilla #1375.
Thanks to Jeremiah Morris for the patch!
--- a/src/video/quartz/SDL_QuartzWM.m Sun Jan 15 03:13:08 2012 -0500
+++ b/src/video/quartz/SDL_QuartzWM.m Mon Jan 16 14:27:47 2012 -0500
@@ -230,7 +230,6 @@
#endif /* Dead code */
void QZ_PrivateWarpCursor (_THIS, int x, int y) {
- CGEventSourceRef evsrc = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
NSPoint p;
CGPoint cgp;
@@ -238,9 +237,11 @@
cgp = QZ_PrivateSDLToCG (this, &p);
/* this is the magic call that fixes cursor "freezing" after warp */
- CGEventSourceSetLocalEventsSuppressionInterval(evsrc, 0.0);
+ CGAssociateMouseAndMouseCursorPosition (0);
CGWarpMouseCursorPosition (cgp);
- CFRelease(evsrc);
+ if (grab_state != QZ_INVISIBLE_GRAB) { /* can't leave it disassociated? */
+ CGAssociateMouseAndMouseCursorPosition (1);
+ }
SDL_PrivateAppActive (QZ_IsMouseInWindow (this), SDL_APPMOUSEFOCUS);
}