/* =========== IN_GrabMouse =========== */ void IN_GrabMouse (void) { if (mouse_available && !mouse_grab_active && x_win) { XWindowAttributes attribs_1; XSetWindowAttributes attribs_2; XGetWindowAttributes(x_disp, x_win, &attribs_1); attribs_2.event_mask = attribs_1.your_event_mask | KEY_MASK | MOUSE_MASK; XChangeWindowAttributes(x_disp, x_win, CWEventMask, &attribs_2); // hide cursor XDefineCursor(x_disp, x_win, CreateNullCursor()); // grab pointer XGrabPointer(x_disp, x_win, True, 0, GrabModeAsync, GrabModeAsync, x_win, None, CurrentTime); if (dga_mouse_available) { if (!vidmode_fullscreen && (vid.width < 640 || vid.height < 480)) Con_Warning ("Running low-res windowed mode, XFree86 DGA Mouse disabled\n"); else IN_ActivateDGAMouse(); } mouse_grab_active = true; } }
static void in_dgamouse_f(struct cvar_s *var) { if (var->value) { Con_DPrintf("Callback: in_dgamouse ON\n"); IN_ActivateDGAMouse(); } else { Con_DPrintf("Callback: in_dgamouse OFF\n"); IN_DeactivateDGAMouse(); } }
void IN_GrabMouse(void) { int err; if (mouse_available && !mouse_grab_active) { XDefineCursor(x_disp, x_win, CreateNullCursor()); err = XGrabPointer(x_disp, x_win, True, 0, GrabModeAsync, GrabModeAsync, x_win, None, CurrentTime); if (err) { if (err == GrabNotViewable) Con_DPrintf("%s: GrabNotViewable\n", __func__); if (err == AlreadyGrabbed) Con_DPrintf("%s: AlreadyGrabbed\n", __func__); if (err == GrabFrozen) Con_DPrintf("%s: GrabFrozen\n", __func__); if (err == GrabInvalidTime) Con_DPrintf("%s: GrabInvalidTime\n", __func__); mouse_grab_active = true; return; } else { mouse_grab_active = true; } #ifdef USE_XF86DGA // FIXME - need those cvar callbacks to fix changed values... if (dga_available) { if (in_dgamouse.value) IN_ActivateDGAMouse(); } else { in_dgamouse.value = 0; } #endif } else { Sys_Error("Bad grab?"); } }