void VID_GrabMouse(qboolean grab)
{
+ qboolean usedgamouse;
if (!vidx11_display)
return;
+ usedgamouse = grab && vid.mouseaim && vid_dgamouse.integer;
+#if !defined(__APPLE__) && !defined(SUNOS)
+ if (!vid_x11_dgasupported)
+ usedgamouse = false;
+#endif
if (grab)
{
#if !defined(__APPLE__) && !defined(SUNOS)
- if(vid_usingmouse && (vid_usingdgamouse != !!vid_dgamouse.integer))
+ if(vid_usingmouse && (vid_usingdgamouse != usedgamouse))
VID_GrabMouse(false); // ungrab first!
#endif
if (!vid_usingmouse && mouse_avail && win)
XGrabPointer(vidx11_display, win, True, 0, GrabModeAsync, GrabModeAsync, win, None, CurrentTime);
#if !defined(__APPLE__) && !defined(SUNOS)
- if (vid_dgamouse.integer && vid_x11_dgasupported)
+ vid_usingdgamouse = usedgamouse;
+ if (usedgamouse)
{
XF86DGADirectVideo(vidx11_display, DefaultScreen(vidx11_display), XF86DGADirectMouse);
XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, 0, 0);
cl_ignoremousemoves = 2;
vid_usingmouse = true;
-#if !defined(__APPLE__) && !defined(SUNOS)
- vid_usingdgamouse = !!vid_dgamouse.integer;
-#endif
}
}
else
if (vid_usingmouse)
{
#if !defined(__APPLE__) && !defined(SUNOS)
- if (vid_x11_dgasupported)
+ if (vid_usingdgamouse)
XF86DGADirectVideo(vidx11_display, DefaultScreen(vidx11_display), 0);
+ vid_usingdgamouse = false;
#endif
XUngrabPointer(vidx11_display, CurrentTime);
if (vid.mouseaim)
{
#if !defined(__APPLE__) && !defined(SUNOS)
- if (vid_dgamouse.integer == 1 && vid_x11_dgasupported)
+ if (vid_usingdgamouse)
{
in_mouse_x += event.xmotion.x_root;
in_mouse_y += event.xmotion.y_root;