#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <X11/XKBlib.h> // TODO possibly ifdef this out on non-supporting systems... Solaris (as always)?
#include <GL/glx.h>
#include "quakedef.h"
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
if (!vidx11_display || !win)
return;
if (!mouse_avail)
fullscreengrab = relative = hidecursor = false;
- usedgamouse = relative && vid_dgamouse.integer;
#if !defined(__APPLE__) && !defined(SUNOS)
+ usedgamouse = relative && vid_dgamouse.integer;
if (!vid_x11_dgasupported)
usedgamouse = false;
if (fullscreengrab && vid_usingmouse && (vid_usingdgamouse != usedgamouse))
#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;
}
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;
}
}
in_mouse_x += event.xmotion.x - in_windowmouse_x;
in_mouse_y += event.xmotion.y - in_windowmouse_y;
//if (abs(vid.width/2 - event.xmotion.x) + abs(vid.height/2 - event.xmotion.y))
- if (abs(vid.width/2 - event.xmotion.x) > vid.width / 4 || abs(vid.height/2 - event.xmotion.y) > vid.height / 4)
+ if (vid_stick_mouse.integer || abs(vid.width/2 - event.xmotion.x) > vid.width / 4 || abs(vid.height/2 - event.xmotion.y) > vid.height / 4)
dowarp = true;
}
}
return false;
}
+ // make autorepeat send keypress/keypress/.../keyrelease instead of intervening keyrelease
+ XkbSetDetectableAutoRepeat(vidx11_display, true, NULL);
+
vidx11_screen = DefaultScreen(vidx11_display);
root = RootWindow(vidx11_display, vidx11_screen);
VID_BuildGLXAttrib(attrib, bpp == 32, stereobuffer, samples);
visinfo = qglXChooseVisual(vidx11_display, vidx11_screen, attrib);
- if (!visinfo && (samples == 1))
- {
- /* Some Mesa drivers reject sample buffers with 1 sample, so try
- * entirely without one */
- VID_BuildGLXAttrib(attrib, bpp == 32, stereobuffer, 0);
- visinfo = qglXChooseVisual(vidx11_display, vidx11_screen, attrib);
- }
if (!visinfo)
{
Con_Print("Couldn't get an RGB, Double-buffered, Depth visual\n");