Listen to input from core pointer/keyboard devices

Peter Hutterer peter.hutterer at who-t.net
Mon Feb 9 13:30:26 PST 2009


On Mon, Feb 09, 2009 at 01:50:16PM +0300, Andrey Pokrovskiy wrote:
> 2. Receive MotionNotify from every window (the synergy way). The idea is to
> select MotionNotify event for every window on every screen. We will also
> need to select CreateNotify event to select MotionNotify for newly created
> windows. The bad side of this, that if some windows grabs the pointer we
> will not receive any events, because they are delivered only to window that
> grabs the pointer.

Doesn't synergy just grab the pointer and warp it back into the middle? That
would make the most sense, certainly more than registering for events on each
window.

> 3. Listen to device events (I failed to find some popular examples). We can
> use XListInputDevices() to get list of available devices. The we can open
> one of it (for example, that has type "MOUSE") using XOpenDevice() and then
> call XSelectExtensionEvent() to select inpu from it. It works great when we
> have at least on extension device in the list (also, behavior can vary
> between different extension devices, but it is not the problem now).
> 
> Lets talk about 3. We can have only 2 devices in list: "core keyboard" and
> "core pointer" (which are of IsXKeyboard and IsXpointer use flags in
> corresponding XDeviceInfo structure). As written in man, XOpenDevice() will
> fail for X keyboard and X pointer. I don't understand why it is designed so
> and what the problem was solved by this, but it is the problem for me now :)

That's the behaviour of git master. Up to 1.6, it should list all physical
devices separately. master is a bit different because of mpx, so you only see
floating slave devices on top of the vcp/vck unless you announce support for
XI2 (XQueryInputVersion(dpy, 2, 0), basically).
Note that there may be a device grab on the device, so this doesn't fix your
problem either.

> So, the question can be devided on two parts:
> 1. Is there ant way to select X pointer/keyboard (core devices) events?
> 2. Maybe there is more direct/simple/right way to do what I need?

You can't do it, in the end, you'll always lose because of grabs. What do you
need it for?

Cheers,
  Peter


More information about the xorg-devel mailing list