<div dir="ltr">Thanks for your help! I was able to finish my program and it now behaves as I expect.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 30, 2019 at 6:24 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 Tue, Apr 30, 2019 at 08:07:18AM -0400, Eric Sokolowsky wrote:<br>
> Yes, I checked the status of the XIGrabDevice call. It was 0. I followed<br>
> your suggestion on using the device's id, and it does appear to work<br>
> better, at least well enough for my purposes. The only confusing thing now<br>
> is that I am getting event 35 (GenericEvent) back to my application when<br>
> the buttons on the remote are pressed. Do you have any pointers to<br>
> documentation on how I might get the key events from these?  Thanks for<br>
> your help.<br>
<br>
all XI2 events are generic events and you need to handle those accordingly.<br>
google for "XI2 recipes", I think that set of blog post has the<br>
explanations and should get you started. Otherwise, the xinput source code<br>
(for 'test-xi2') will be helpful too as it's sort-of the minimal client for<br>
XI2 event handling.<br>
<br>
Cheers,<br>
   Peter<br>
<br>
> On Mon, Apr 29, 2019 at 9:27 PM Peter Hutterer <<a href="mailto:peter.hutterer@who-t.net" target="_blank">peter.hutterer@who-t.net</a>><br>
> wrote:<br>
> <br>
> > 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<br>
> > presentation,<br>
> > > under Linux and using X11. I have a USB presentation remote that acts as<br>
> > a<br>
> > > very miniature keyboard (four buttons: Page Up, Page Down, and two<br>
> > others)<br>
> > > which can be used to advance and go back in the presentation. I would<br>
> > like<br>
> > > to have my presentation application to receive all of the events from<br>
> > this<br>
> > > remote regardless of where the mouse focus is. But I would also like to<br>
> > be<br>
> > > able to receive the normal mouse and keyboard events if the current<br>
> > 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>
> ><br>
<br>
> _______________________________________________<br>
> <a href="mailto:xorg@lists.x.org" target="_blank">xorg@lists.x.org</a>: X.Org support<br>
> Archives: <a href="http://lists.freedesktop.org/archives/xorg" rel="noreferrer" target="_blank">http://lists.freedesktop.org/archives/xorg</a><br>
> Info: <a href="https://lists.x.org/mailman/listinfo/xorg" rel="noreferrer" target="_blank">https://lists.x.org/mailman/listinfo/xorg</a><br>
> Your subscription address: %(user_address)s<br>
<br>
</blockquote></div>