Mac: Fix incorrect relative jump on focus / start.
We should no longer send huge jumps on relative mode focus changes if the cursor was moved around, or on initial start. Fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1836
This commit is contained in:
parent
95cf57b19f
commit
f1fc414daa
2 changed files with 8 additions and 5 deletions
|
@ -224,10 +224,12 @@ Cocoa_WarpMouse(SDL_Window * window, int x, int y)
|
|||
CGWarpMouseCursorPosition(point);
|
||||
CGSetLocalEventsSuppressionInterval(0.25);
|
||||
|
||||
/* CGWarpMouseCursorPosition doesn't generate a window event, unlike our
|
||||
* other implementations' APIs.
|
||||
*/
|
||||
SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y);
|
||||
if (!mouse->relative_mode) {
|
||||
/* CGWarpMouseCursorPosition doesn't generate a window event, unlike our
|
||||
* other implementations' APIs.
|
||||
*/
|
||||
SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -240,12 +240,13 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
|||
- (void)windowDidBecomeKey:(NSNotification *)aNotification
|
||||
{
|
||||
SDL_Window *window = _data->window;
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
/* We're going to get keyboard events, since we're key. */
|
||||
SDL_SetKeyboardFocus(window);
|
||||
|
||||
/* If we just gained focus we need the updated mouse position */
|
||||
{
|
||||
if (!mouse->relative_mode) {
|
||||
NSPoint point;
|
||||
int x, y;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue