From c9ab94ecd5bcd5b99cfae425e147b229d114a139 Mon Sep 17 00:00:00 2001 From: divverent Date: Sun, 9 Nov 2008 11:50:44 +0000 Subject: [PATCH] add code to vid_glx to turn off mouse acceleration; also support vid_wgl's option -noforcemparms in X11 to turn off that new code makes vid_dgamouse 0 a viable workaround for the ubuntu evdev problems git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8551 d7cf8633-e32d-0410-b094-e92efae38249 --- vid_glx.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/vid_glx.c b/vid_glx.c index 61d83b0c..38bc5a1c 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -252,6 +252,11 @@ static Cursor CreateNullCursor(Display *display, Window root) void VID_SetMouse(qboolean fullscreengrab, qboolean relative, qboolean hidecursor) { + static int originalmouseparms_num; + static int originalmouseparms_denom; + static int originalmouseparms_threshold; + static qboolean restore_spi; + #if !defined(__APPLE__) && !defined(SUNOS) qboolean usedgamouse; #endif @@ -312,6 +317,20 @@ void VID_SetMouse(qboolean fullscreengrab, qboolean relative, qboolean hidecurso #endif XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, vid.width / 2, vid.height / 2); +// COMMANDLINEOPTION: X11 Input: -noforcemparms disables setting of mouse parameters (not used with DGA, windows only) +#if !defined(__APPLE__) && !defined(SUNOS) + if (!COM_CheckParm ("-noforcemparms") && !usedgamouse) +#else + if (!COM_CheckParm ("-noforcemparms")) +#endif + { + XGetPointerControl(vidx11_display, &originalmouseparms_num, &originalmouseparms_denom, &originalmouseparms_threshold); + XChangePointerControl (vidx11_display, true, false, 1, 1, -1); // TODO maybe change threshold here, or remove this comment + restore_spi = true; + } + else + restore_spi = false; + cl_ignoremousemoves = 2; vid_usingmouse = true; } @@ -326,6 +345,11 @@ void VID_SetMouse(qboolean fullscreengrab, qboolean relative, qboolean hidecurso vid_usingdgamouse = false; #endif cl_ignoremousemoves = 2; + + if (restore_spi) + XChangePointerControl (vidx11_display, true, true, originalmouseparms_num, originalmouseparms_denom, originalmouseparms_threshold); + restore_spi = false; + vid_usingmouse = false; } } @@ -382,6 +406,7 @@ static void HandleEvents(void) // key pressed key = XLateKey (&event.xkey, &ascii); Key_Event(key, ascii, true); + printf("keypress\n"); break; case KeyRelease: -- 2.39.2