diff -r 398073b195bb src/video/cocoa/SDL_cocoamouse.m --- a/src/video/cocoa/SDL_cocoamouse.m Fri Dec 14 23:05:34 2012 -0800 +++ b/src/video/cocoa/SDL_cocoamouse.m Sat Dec 15 20:18:07 2012 +1030 @@ -179,6 +179,14 @@ CGWarpMouseCursorPosition(point); } +/* + * It seems that after calling CGAssociateMouseAndMouseCursorPosition(false), + * the first relative event will report the jump from current position back to + * whatever fixed point it is going to report from then onwards. Simplest + * thing to do seems to be just ignore the first relative event. + */ +static SDL_bool ignore_one_relative_event = SDL_FALSE; + static int Cocoa_SetRelativeMouseMode(SDL_bool enabled) { @@ -193,6 +201,9 @@ SDL_SetError("CGAssociateMouseAndMouseCursorPosition() failed"); return -1; } + + ignore_one_relative_event = enabled; + return 0; } @@ -216,6 +227,11 @@ { SDL_Mouse *mouse = SDL_GetMouse(); + if (mouse->relative_mode && ignore_one_relative_event) { + ignore_one_relative_event = SDL_FALSE; + return; + } + if (mouse->relative_mode && ([event type] == NSMouseMoved || [event type] == NSLeftMouseDragged ||