Mac: Make mouse movement smooth at edge of window when grabbed.

There's a limit of one update every 250ms when warping the mouse, and we
can work around that by disassociating the cursor & the mouse before
issuing our warp, then re-associating them.

--HG--
extra : histedit_source : 91ddf6078107ea9faf1c769a459e99bce6e61180
This commit is contained in:
Jørgen P. Tjernø 2013-04-23 18:47:38 -07:00
parent 694ebd59a3
commit 4f88e70fe6

View file

@ -392,7 +392,14 @@ 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.
*/
CGAssociateMouseAndMouseCursorPosition(NO);
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
CGAssociateMouseAndMouseCursorPosition(YES);
}
}
SDL_SendMouseMotion(window, 0, 0, x, y);