Re: [dev] Lock mouse focus on window

From: Rob <robpilling_AT_gmail.com>
Date: Sun, 30 Jan 2011 13:06:54 +0000

> 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

Received on Sun Jan 30 2011 - 14:06:54 CET

This archive was generated by hypermail 2.2.0 : Sun Jan 30 2011 - 14:12:02 CET