Skip to content
Permalink
Browse files

Quartz: Fix mouse warping freezing for 250+ milliseconds.

Fixes Bugzilla #1375.

Thanks to Jeremiah Morris for the patch!
  • Loading branch information
icculus committed Jan 16, 2012
1 parent f33068b commit a2fd04dd3451c67dda9dfbd423ae4d0403d37eff

File 1 of 1 in a2fd04d

@@ -230,17 +230,18 @@ void QZ_PrivateCGToSDL (_THIS, NSPoint *p) {
#endif /* Dead code */

void QZ_PrivateWarpCursor (_THIS, int x, int y) {
CGEventSourceRef evsrc = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
NSPoint p;
CGPoint cgp;

p = NSMakePoint (x, y);
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);
}

0 comments on commit a2fd04d

Please sign in to comment.