changed cl_ignoremousemove from a qboolean to an int named
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 25 Dec 2007 06:08:32 +0000 (06:08 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 25 Dec 2007 06:08:32 +0000 (06:08 +0000)
cl_ignoremousemoves which is set to 2 whenever the mouse grab state
changes, the one-frame ignore was not working

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7856 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c
client.h
vid_glx.c
vid_sdl.c
vid_shared.c
vid_wgl.c

index a188693..fe3e67c 100644 (file)
@@ -503,7 +503,7 @@ void CL_AdjustAngles (void)
        cl.viewangles[ROLL] = bound(-50, cl.viewangles[ROLL], 50);
 }
 
-qboolean cl_ignoremousemove = false;
+int cl_ignoremousemoves = 2;
 
 /*
 ================
@@ -562,9 +562,9 @@ void CL_Input (void)
        IN_Move ();
 
        // ignore a mouse move if mouse was activated/deactivated this frame
-       if (cl_ignoremousemove)
+       if (cl_ignoremousemoves)
        {
-               cl_ignoremousemove = false;
+               cl_ignoremousemoves--;
                in_mouse_x = 0;
                in_mouse_y = 0;
        }
index 28c047d..0e3163d 100644 (file)
--- a/client.h
+++ b/client.h
@@ -1180,7 +1180,7 @@ void CL_SetInfo(const char *key, const char *value, qboolean send, qboolean allo
 void CL_UpdateWorld (void);
 void CL_WriteToServer (void);
 void CL_Input (void);
-extern qboolean cl_ignoremousemove;
+extern int cl_ignoremousemoves;
 
 
 float CL_KeyState (kbutton_t *key);
index 7f5fbe0..02911ed 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -282,7 +282,7 @@ static void IN_Activate (qboolean grab)
                                XGrabKeyboard(vidx11_display, win, False, GrabModeAsync, GrabModeAsync, CurrentTime);
 
                        mouse_x = mouse_y = 0;
-                       cl_ignoremousemove = true;
+                       cl_ignoremousemoves = 2;
                        vid_usingmouse = true;
                }
        }
@@ -302,7 +302,7 @@ static void IN_Activate (qboolean grab)
                        if (win)
                                XUndefineCursor(vidx11_display, win);
 
-                       cl_ignoremousemove = true;
+                       cl_ignoremousemoves = 2;
                        vid_usingmouse = false;
                }
        }
index a9adbde..959105f 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -241,7 +241,7 @@ static void IN_Activate( qboolean grab )
                if (!vid_usingmouse)
                {
                        vid_usingmouse = true;
-                       cl_ignoremousemove = true;
+                       cl_ignoremousemoves = 2;
                        SDL_WM_GrabInput( SDL_GRAB_ON );
                        SDL_ShowCursor( SDL_DISABLE );
                }               
@@ -251,7 +251,7 @@ static void IN_Activate( qboolean grab )
                if (vid_usingmouse)
                {
                        vid_usingmouse = false;
-                       cl_ignoremousemove = true;
+                       cl_ignoremousemoves = 2;
                        SDL_WM_GrabInput( SDL_GRAB_OFF );
                        SDL_ShowCursor( SDL_ENABLE );
                }
index 3ea646e..02e0fcd 100644 (file)
@@ -1018,6 +1018,7 @@ void VID_Shared_Init(void)
 
 int VID_Mode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer)
 {
+       cl_ignoremousemoves = 2;
        Con_Printf("Video: %s %dx%dx%dx%dhz%s\n", fullscreen ? "fullscreen" : "window", width, height, bpp, refreshrate, stereobuffer ? " stereo" : "");
        if (VID_InitMode(fullscreen, width, height, bpp, refreshrate, stereobuffer))
        {
index 322eb6b..4f97d31 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -1004,7 +1004,7 @@ static void IN_Activate (qboolean grab)
                if (!vid_usingmouse)
                {
                        vid_usingmouse = true;
-                       cl_ignoremousemove = true;
+                       cl_ignoremousemoves = 2;
                        if (dinput && g_pMouse)
                        {
                                IDirectInputDevice_Acquire(g_pMouse);
@@ -1043,7 +1043,7 @@ static void IN_Activate (qboolean grab)
                if (vid_usingmouse)
                {
                        vid_usingmouse = false;
-                       cl_ignoremousemove = true;
+                       cl_ignoremousemoves = 2;
                        if (dinput_acquired)
                        {
                                IDirectInputDevice_Unacquire(g_pMouse);