Skip to content

Commit

Permalink
Quartz: Fix mouse warping freezing for 250+ milliseconds.
Browse files Browse the repository at this point in the history
Fixes Bugzilla #1375.

Thanks to Jeremiah Morris for the patch!
  • Loading branch information
icculus committed Jan 16, 2012
1 parent f33068b commit a2fd04d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/video/quartz/SDL_QuartzWM.m
Expand Up @@ -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);
}

Expand Down

0 comments on commit a2fd04d

Please sign in to comment.