Discussion:
XiGrabDevice locks out other devices?
Eric Sokolowsky
2018-10-25 16:16:24 UTC
Permalink
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.

Eric
Peter Hutterer
2018-10-25 23:48:10 UTC
Permalink
Post by Eric Sokolowsky
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.

Cheer,
Peter


_______________________________________________
***@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscri

Loading...