cl.viewangles[ROLL] = bound(-50, cl.viewangles[ROLL], 50);
}
+qboolean cl_ignoremousemove = false;
+
/*
================
CL_Move
// allow mice or other external controllers to add to the move
IN_Move ();
+ // ignore a mouse move if mouse was activated/deactivated this frame
+ if (cl_ignoremousemove)
+ {
+ cl_ignoremousemove = false;
+ in_mouse_x = 0;
+ in_mouse_y = 0;
+ }
+
// apply m_filter if it is on
mx = in_mouse_x;
my = in_mouse_y;
int CL_ReadFromServer (void);
void CL_WriteToServer (void);
void CL_Move (void);
+extern qboolean cl_ignoremousemove;
float CL_KeyState (kbutton_t *key);
static qboolean vid_usemouse = false;
static qboolean vid_usingvsync = false;
static qboolean vid_usevsync = false;
-static qboolean ignoremousemove = false;
static float mouse_x, mouse_y;
static int p_mouse_x, p_mouse_y;
XGrabKeyboard(vidx11_display, win, False, GrabModeAsync, GrabModeAsync, CurrentTime);
mouse_x = mouse_y = 0;
- ignoremousemove = true;
+ cl_ignoremousemove = true;
vid_usingmouse = true;
}
}
if (win)
XUndefineCursor(vidx11_display, win);
- ignoremousemove = true;
+ cl_ignoremousemove = true;
vid_usingmouse = false;
}
}
p_mouse_y = scr_height / 2;
XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, p_mouse_x, p_mouse_y);
}
-
- // if told to ignore one mouse move, do so
- if (ignoremousemove)
- {
- ignoremousemove = false;
- mouse_x = 0;
- mouse_y = 0;
- }
}
static void *prjobj = NULL;
vid_usingmouse = false;
vid_usingvsync = false;
- ignoremousemove = true;
vid_hidden = false;
vid_activewindow = true;
GL_Init();
static SDL_Surface *screen;
-static void IN_Init( void );
-static void IN_Shutdown( void );
-
/////////////////////////
// Input handling
////
if (!vid_usingmouse)
{
vid_usingmouse = true;
+ cl_ignoremousemove = true;
SDL_WM_GrabInput( SDL_GRAB_ON );
SDL_ShowCursor( SDL_DISABLE );
}
if (vid_usingmouse)
{
vid_usingmouse = false;
+ cl_ignoremousemove = true;
SDL_WM_GrabInput( SDL_GRAB_OFF );
SDL_ShowCursor( SDL_ENABLE );
}
}
}
-static void IN_Init( void )
-{
- // init keyboard
- SDL_EnableUNICODE( SDL_ENABLE );
- // enable key repeat since everyone expects it
- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
-
- // init mouse
- vid_usingmouse = false;
-}
-
-static void IN_Shutdown( void )
-{
-}
-
/////////////////////
// Message Handling
////
vid_isfullscreen = false;
SDL_SetEventFilter( (SDL_EventFilter) Sys_EventFilter );
- IN_Init();
+ // init keyboard
+ SDL_EnableUNICODE( SDL_ENABLE );
+ // enable key repeat since everyone expects it
+ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
}
// set the icon (we dont use SDL here since it would be too much a PITA)
vid_hidden = false;
vid_activewindow = false;
vid_usingmouse = false;
- IN_Init();
return true;
}
void VID_Shutdown (void)
{
- IN_Shutdown();
+ IN_Activate(false);
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
static int originalmouseparms[3], newmouseparms[3] = {0, 0, 1};
static unsigned int uiWheelMessage;
-static qboolean mouseparmsvalid, mouseactivatetoggle;
+static qboolean mouseparmsvalid;
static qboolean dinput_acquired;
static unsigned int mstate_di;
vid_usemouse = true;
if (!vid_activewindow)
vid_usemouse = false;
- if (vid_usemouse)
- {
- if (!vid_usingmouse)
- {
- vid_usingmouse = true;
- IN_Activate (true);
- }
- }
- else
- {
- if (vid_usingmouse)
- {
- vid_usingmouse = false;
- IN_Activate (false);
- }
- }
+ IN_Activate(vid_usemouse);
if (r_render.integer && !vid_hidden)
{
if (!fActive)
{
- vid_usingmouse = false;
IN_Activate (false);
if (vid_isfullscreen)
{
if (grab)
{
- mouseactivatetoggle = true;
- if (dinput && g_pMouse)
- {
- IDirectInputDevice_Acquire(g_pMouse);
- dinput_acquired = true;
- }
- else
+ if (!vid_usingmouse)
{
- RECT window_rect;
- window_rect.left = window_x;
- window_rect.top = window_y;
- window_rect.right = window_x + window_width;
- window_rect.bottom = window_y + window_height;
- if (mouseparmsvalid)
- restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);
- SetCursorPos (window_center_x, window_center_y);
- SetCapture (mainwindow);
- ClipCursor (&window_rect);
+ vid_usingmouse = true;
+ cl_ignoremousemove = true;
+ if (dinput && g_pMouse)
+ {
+ IDirectInputDevice_Acquire(g_pMouse);
+ dinput_acquired = true;
+ }
+ else
+ {
+ RECT window_rect;
+ window_rect.left = window_x;
+ window_rect.top = window_y;
+ window_rect.right = window_x + window_width;
+ window_rect.bottom = window_y + window_height;
+ if (mouseparmsvalid)
+ restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);
+ SetCursorPos (window_center_x, window_center_y);
+ SetCapture (mainwindow);
+ ClipCursor (&window_rect);
+ }
+ ShowCursor (false);
}
- vid_usingmouse = true;
- ShowCursor (false);
}
else
{
- mouseactivatetoggle = false;
- if (dinput_acquired)
- {
- IDirectInputDevice_Unacquire(g_pMouse);
- dinput_acquired = false;
- }
- else
+ if (vid_usingmouse)
{
- if (restore_spi)
- SystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0);
- ClipCursor (NULL);
- ReleaseCapture ();
+ vid_usingmouse = false;
+ cl_ignoremousemove = true;
+ if (dinput_acquired)
+ {
+ IDirectInputDevice_Unacquire(g_pMouse);
+ dinput_acquired = false;
+ }
+ else
+ {
+ if (restore_spi)
+ SystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0);
+ ClipCursor (NULL);
+ ReleaseCapture ();
+ }
+ ShowCursor (true);
}
- vid_usingmouse = false;
- ShowCursor (true);
}
}
}
mouse_buttons = 10;
-
-// if a fullscreen video mode was set before the mouse was initialized,
-// set the mouse state appropriately
- if (mouseactivatetoggle)
- IN_Activate (true);
}