-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Am 12.03.2011 14:53, Ng Oon-Ee wrote:
> On Sat, 2011-03-12 at 09:03 +0100, Uli Schlachter wrote:
>>> 3. Does awesome support 'locking' the mouse on a single screen in a
>>> twinview configuration (which to all extents and purposes is identical
>>> to the normal xrandr multi-screen configuration)?
>> In X11 you can tell the X server "alyways keep the mouse pointer inside of 
>> some
>> window". With "seperate X-screens", each screen gets its own root window, so
>> keeping the mouse pointer in that should do what you want.
>> However, with Xinerama there is only one big root window which covers both
>> screens, so this doesn't work here.
>> So, I think polling is the only way to do this.
> 
> I'm interested in the 'always keep the mouse pointer inside of some
> window' bit. Could I be pointed to some documentation on that? I've
> tried hacking away at some code based on the C++ interface to X11 before
> but haven't seen that.
> 
> In TwinView as well I think there's only one big root window (I think).
> Creating a transparent window of the same size as the monitor would work
> though I think.

This can be done via the GrabPointer protocol request[1]. Xlib provides the
XGrabPointer function for this. This gets a confine-to argument which is
described like this (copy&paste from [1]):

If a confine-to window is specified, then the pointer will be restricted to stay
contained in that window. The confine-to window need have no relationship to the
grab-window. If the pointer is not initially in the confine-to window, then it
is warped automatically to the closest edge (and enter/leave events are
generated normally) just before the grab activates. If the confine-to window is
subsequently reconfigured, the pointer will be warped automatically as necessary
to keep it contained in the window.

The problem here is that when you grab the mouse pointer, all mouse events will
only be sent to you and not to e.g. the game that the user wants to play. I
think that one can make this work with a Synchronous grab and sending
AllowEvents / calling XAllowEvents with ReplayPointer after each event...

So in theory this might be possible (Create a InputOnly window of the size you
need, grab the mouse pointer in Synchronous mode with confine-to=your_window and
grab-window=the_root_window, AllowEvents with mode ReplayPointer after each
event), but X11 input processing is still quite some black magic to me. YMMV.

Of course, this causes other clients to be unable to grab the pointer. I bet
this breaks e.g. drag and drop and/or popup menus.

Cheers,
Uli

[1]
http://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.html#requests:GrabPointer

- -- 
- - Buck, when, exactly, did you lose your mind?
- - Three months ago. I woke up one morning married to a pineapple.
  An ugly pineapple... But I loved her.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBCAAGBQJNe3+jAAoJECLkKOvLj8sG67sIAKtk31pCTlkKYspaXafvavv6
oqETaYCAbnpLue7rj9NQZxD6Ely0njNcqiPzv70ynXch3F9SThmuxtW1pb0Bxw0J
rQh8Et7/htmS2htQUpRmkKGcyqratezGZDqYpxEBElckN2150SJdpWcqT5mV3w78
/SYN8Eyn8viqSqyT9CH/Y7rgUJtLst25GUed7TJHf/gmVYscvNgi4vTmTeLokFyd
iUTZ4cFOAeudKRtBVJr2ZzXftRgGh7MVcdv6RsqCk55EWaY3smeWyJYzQJKkg8WK
t/ga9WMD/6cNkpEoWVEpNv67VvZg+7uYck3OjlZZUjSB1JuvtW07Sreq5wT6oHQ=
=JI7I
-----END PGP SIGNATURE-----

-- 
To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.

Reply via email to