<div dir="ltr"><div>Yes, I checked the status of the XIGrabDevice call. It was 0. I followed
your suggestion on using the device's id, and it does appear to work
better, at least well enough for my purposes. The only confusing thing
now is that I am getting event 35 (GenericEvent) back to my application
when the buttons on the remote are pressed. Do you have any pointers to
documentation on how I might get the key events from these? Thanks for
your help.</div><div><br></div><div>Eric<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 29, 2019 at 9:27 PM Peter Hutterer <<a href="mailto:peter.hutterer@who-t.net">peter.hutterer@who-t.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Apr 29, 2019 at 05:42:46PM -0400, Eric Sokolowsky wrote:<br>
> I have an application that is used as a control system for a presentation,<br>
> under Linux and using X11. I have a USB presentation remote that acts as a<br>
> very miniature keyboard (four buttons: Page Up, Page Down, and two others)<br>
> which can be used to advance and go back in the presentation. I would like<br>
> to have my presentation application to receive all of the events from this<br>
> remote regardless of where the mouse focus is. But I would also like to be<br>
> able to receive the normal mouse and keyboard events if the current window<br>
> focus is on the presentation application. Using XIGrabDevice() I was able<br>
> to receive all events from the remote in the presentation application<br>
> regardless of the current focus but I was not able to receive any events<br>
> from the mouse or other keyboard while the grab was active. Is what I'm<br>
> trying to do possible?<br>
> <br>
> Here's the code I'm using:<br>
> <br>
> XIEventMask masks[1];<br>
> unsigned char mask[(XI_LASTEVENT+7)/8];<br>
> memset(mask, 0, sizeof(mask));<br>
> XISetMask(mask, XI_KeyPress);<br>
> masks[0].deviceid = XIAllMasterDevices;<br>
<br>
replace this with the device ID of the remote.<br>
<br>
> masks[0].mask_len = sizeof(mask);<br>
> masks[0].mask = mask;<br>
> Status result = XIGrabDevice(dpy, deviceid, win, CurrentTime, None,<br>
> XIGrabModeAsync, XIGrabModeAsync, True, masks);<br>
> <br>
> Any help would be appreciated. Thank you.<br>
<br>
did you check the status? XIGrabDevice with XIAllMasterDevices should fail<br>
because it doesn't resolve into any device (this is one of the requests<br>
where you can't use that fake device ID). Not sure why this worked at all.<br>
Either way, using the remote's ID should work.<br>
<br>
Cheers,<br>
Peter<br>
</blockquote></div>