> Is there a way to manually lock mouse focus on a window? I'm running a
> game in wine and the mouse leaves the window once I get to the edge.
> Since the game is an FPS this isn't really acceptable. Even if I
> fullscreen the app the mouse just stops when it gets to the window,
> which doesn't really work out. Is there a way I can lock the mouse in
> the window so I get the correct behaviour?

You could add a keybind in dwm/wmii to call XGrabPointer to toggle a
lock on the currently focused window. Since it's only grabbing the
pointer, dwm/wmii will still be able to read the key to ungrab.

I've attached code for dwm anyway.

config.h:
{ MODKEY,            XK_l,  pointerlock,    { .i = 1 } },
{ MODKEY|ShiftMask,  XK_l,  pointerlock,    { .i = 0 } },


Cheers,
Rob
void
pointerlock(const Arg *a)
{
	if(a->i){
		if(XGrabPointer(dpy, selmon->sel->win, False, MOUSEMASK,
				GrabModeAsync, GrabModeAsync,
				selmon->sel->win, None, CurrentTime) != GrabSuccess)
			fprintf(stderr, "dwm: XGrabPointer() failed\n");
	}else
		XUngrabPointer(dpy, CurrentTime);
}

Reply via email to