Capturing all events from a presentation remote while allowing all other events to be sent normally
Peter Hutterer
peter.hutterer at who-t.net
Tue Apr 30 01:27:37 UTC 2019
On Mon, Apr 29, 2019 at 05:42:46PM -0400, Eric Sokolowsky wrote:
> I have an application that is used as a control system for a presentation,
> under Linux and using X11. I have a USB presentation remote that acts as a
> very miniature keyboard (four buttons: Page Up, Page Down, and two others)
> which can be used to advance and go back in the presentation. I would like
> to have my presentation application to receive all of the events from this
> remote regardless of where the mouse focus is. But I would also like to be
> able to receive the normal mouse and keyboard events if the current window
> focus is on the presentation application. Using XIGrabDevice() I was able
> to receive all events from the remote in the presentation application
> regardless of the current focus but I was not able to receive any events
> from the mouse or other keyboard while the grab was active. Is what I'm
> trying to do possible?
>
> Here's the code I'm using:
>
> XIEventMask masks[1];
> unsigned char mask[(XI_LASTEVENT+7)/8];
> memset(mask, 0, sizeof(mask));
> XISetMask(mask, XI_KeyPress);
> masks[0].deviceid = XIAllMasterDevices;
replace this with the device ID of the remote.
> masks[0].mask_len = sizeof(mask);
> masks[0].mask = mask;
> Status result = XIGrabDevice(dpy, deviceid, win, CurrentTime, None,
> XIGrabModeAsync, XIGrabModeAsync, True, masks);
>
> Any help would be appreciated. Thank you.
did you check the status? XIGrabDevice with XIAllMasterDevices should fail
because it doesn't resolve into any device (this is one of the requests
where you can't use that fake device ID). Not sure why this worked at all.
Either way, using the remote's ID should work.
Cheers,
Peter
More information about the xorg
mailing list