foxygit / doom Log in
commit a06d40ddad9fc1445d25821f94afeded981fd055
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Tue Jan 5 23:53:03 2016 +0100
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Tue Jan 5 23:53:03 2016 +0100

    video: Fix jump after mouse grab.

    Call SDL_GetRelativeMouseState() after setting mouse grab to clear out
    any artificial mouse movement generated by the mode switch. This stops
    the player from turning abruptly when toggling the main menu.
---
 src/i_video.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/i_video.c b/src/i_video.c
index 6248b8e0..143a9b50 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -238,6 +238,7 @@ static void SetShowCursor(boolean show)
         // When the cursor is hidden, grab the input.
         // Relative mode implicitly hides the cursor.
         SDL_SetRelativeMouseMode(!show);
+        SDL_GetRelativeMouseState(NULL, NULL);
     }
 }