Fix mouse warping

In some cases, the warp back to center was being detected as a mouse motion, causing all sorts of silliness with the mouse. The workaround is by only using the first motion event and ignoring every event after that, until the next call to I_GetEvent.
This commit is contained in:
Ronald Kinard 2014-11-13 03:51:33 -06:00
parent b82f64dea5
commit 0913bd44af

View file

@ -987,6 +987,9 @@ static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
void I_GetEvent(void) void I_GetEvent(void)
{ {
SDL_Event evt; SDL_Event evt;
// We only want the first motion event,
// otherwise we'll end up catching the warp back to center.
int mouseMotionOnce = 0;
if (!graphics_started) if (!graphics_started)
{ {
@ -1005,7 +1008,8 @@ void I_GetEvent(void)
Impl_HandleKeyboardEvent(evt.key, evt.type); Impl_HandleKeyboardEvent(evt.key, evt.type);
break; break;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
Impl_HandleMouseMotionEvent(evt.motion); if (!mouseMotionOnce) Impl_HandleMouseMotionEvent(evt.motion);
mouseMotionOnce = 1;
break; break;
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN: