- XWindowAttributes attribs_1;
- XSetWindowAttributes attribs_2;
-
- XGetWindowAttributes(dpy, win, &attribs_1);
- attribs_2.event_mask = attribs_1.your_event_mask | KEY_MASK | MOUSE_MASK;
- XChangeWindowAttributes(dpy, win, CWEventMask, &attribs_2);
-
-// inviso cursor
- XDefineCursor(dpy, win, CreateNullCursor(dpy, win));
-
- XGrabPointer(dpy, win, True, 0, GrabModeAsync, GrabModeAsync,
- win, None, CurrentTime);
-
- if (in_dga.value) {
- int MajorVersion, MinorVersion;
-
- if (!XF86DGAQueryVersion(dpy, &MajorVersion, &MinorVersion)) {
- // unable to query, probalby not supported
- Con_Printf( "Failed to detect XF86DGA Mouse\n" );
- in_dga.value = 0;
- } else {
- in_dga.value = 1;
- XF86DGADirectVideo(dpy, DefaultScreen(dpy), XF86DGADirectMouse);
- XWarpPointer(dpy, None, win, 0, 0, 0, 0, 0, 0);
- }
- } else {
- XWarpPointer(dpy, None, win,
- 0, 0, 0, 0,
- vid.width / 2, vid.height / 2);
- }
-
- XGrabKeyboard(dpy, win, False, GrabModeAsync, GrabModeAsync, CurrentTime);
+ if (!vidx11_display)
+ return;
+ if (grab)
+ {
+ if (!vid_usingmouse && mouse_avail && win)
+ {
+ XWindowAttributes attribs_1;
+ XSetWindowAttributes attribs_2;
+
+ XGetWindowAttributes(vidx11_display, win, &attribs_1);
+ attribs_2.event_mask = attribs_1.your_event_mask | KEY_MASK | MOUSE_MASK;
+ XChangeWindowAttributes(vidx11_display, win, CWEventMask, &attribs_2);
+
+ // inviso cursor
+ XDefineCursor(vidx11_display, win, CreateNullCursor(vidx11_display, win));
+
+ XGrabPointer(vidx11_display, win, True, 0, GrabModeAsync, GrabModeAsync, win, None, CurrentTime);
+
+#if !defined(__APPLE__) && !defined(SUNOS)
+ if (vid_dga.integer)
+ {
+ int MajorVersion, MinorVersion;
+
+ if (!XF86DGAQueryVersion(vidx11_display, &MajorVersion, &MinorVersion))
+ {
+ // unable to query, probably not supported
+ Con_Print( "Failed to detect XF86DGA Mouse\n" );
+ Cvar_SetValueQuick(&vid_dga, 0);
+ XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, vid.width / 2, vid.height / 2);
+ }
+ else
+ {
+ XF86DGADirectVideo(vidx11_display, DefaultScreen(vidx11_display), XF86DGADirectMouse);
+ XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, 0, 0);
+ }
+ }
+ else
+#endif
+ XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, vid.width / 2, vid.height / 2);