foxygit / doom Log in
commit e40b14026828e11fb229c614bc0247edcdd90afb
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Mon May 29 13:25:38 2006 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Mon May 29 13:25:38 2006 +0000

    Warp mouse to screen center (possibly fix joe's mouse problem).

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 538
---
 src/i_video.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index 62ad2c79..a6d30982 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 536 2006-05-29 10:38:27Z fraggle $
+// $Id: i_video.c 538 2006-05-29 13:25:38Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -175,7 +175,7 @@
 //-----------------------------------------------------------------------------

 static const char
-rcsid[] = "$Id: i_video.c 536 2006-05-29 10:38:27Z fraggle $";
+rcsid[] = "$Id: i_video.c 538 2006-05-29 13:25:38Z fraggle $";

 #include <SDL.h>
 #include <ctype.h>
@@ -600,6 +600,13 @@ static void I_ReadMouse(void)

         D_PostEvent(&ev);
     }
+
+    if (MouseShouldBeGrabbed())
+    {
+        SDL_WarpMouse(screen->w / 2, screen->h / 2);
+        SDL_PumpEvents();
+        SDL_GetRelativeMouseState(NULL, NULL);
+    }
 }

 //