XiGrabDevice locks out other devices?

Peter Hutterer peter.hutterer at who-t.net
Thu Oct 25 23:48:10 UTC 2018

On Thu, Oct 25, 2018 at 12:16:24PM -0400, Eric Sokolowsky wrote:
> Hi,
> I'm writing some software that controls a presentation. I have a
> presentation remote that appears as a keyboard, and it works to advance the
> presentation as long as application has focus. What I would like to do is
> to force that particular presentation remote always send its events to the
> presentation application regardless of focus, so I can work in other
> windows while the presentation is going on, and still be able to interact
> with the application using my other keyboard and mouse. Using XIGrabDevice
> I was able to get this partially working in that it did solely get all
> events from the presentation remote, but it seemed to also lock out any
> other device (my regular mouse and keyboard). Is this intended behavior? Is
> there a way to force this one device to this application while letting all
> other devices act normally? Thanks to any insights you can provide.

XIGrabDevice on the device itself should give you all events from that
device until ungrabbed again. If you call XIGrabDevice on the Virtual Core
Pointer device though, you'll effectively grab all devices. It shouldn't
"lock out" any other devices but tbh this is all a bit complicated because
unless your whole application is XI2 and supports multiple devices, there's
bound to be some confusion when it comes to the XI2/core events overlap. 

There's a side-effect of XIGrabDevice in that if you do grab a pointer
device, it'll be detached from the system cursor and you need to make sure
you're handling the focus/enter events correctly from then onwards, but for
your intention, this shouldn't matter.

So in summary, should work with a few corner cases.


More information about the xorg mailing list