From 086c8dacd4a8fb0ff75d6b57e3824063c365e4c4 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 25 Dec 2007 06:08:32 +0000 Subject: [PATCH] changed cl_ignoremousemove from a qboolean to an int named 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 | 6 +++--- client.h | 2 +- vid_glx.c | 4 ++-- vid_sdl.c | 4 ++-- vid_shared.c | 1 + vid_wgl.c | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cl_input.c b/cl_input.c index a1886936..fe3e67cf 100644 --- a/cl_input.c +++ b/cl_input.c @@ -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; } diff --git a/client.h b/client.h index 28c047d6..0e3163d1 100644 --- 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); diff --git a/vid_glx.c b/vid_glx.c index 7f5fbe05..02911ed8 100644 --- 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; } } diff --git a/vid_sdl.c b/vid_sdl.c index a9adbde3..959105fb 100644 --- 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 ); } diff --git a/vid_shared.c b/vid_shared.c index 3ea646e7..02e0fcdd 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -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)) { diff --git a/vid_wgl.c b/vid_wgl.c index 322eb6b9..4f97d31a 100644 --- 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); -- 2.39.2