On Tue, Apr 30, 2019 at 08:07:18AM -0400, Eric Sokolowsky wrote: > 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.
all XI2 events are generic events and you need to handle those accordingly. google for "XI2 recipes", I think that set of blog post has the explanations and should get you started. Otherwise, the xinput source code (for 'test-xi2') will be helpful too as it's sort-of the minimal client for XI2 event handling. Cheers, Peter > On Mon, Apr 29, 2019 at 9:27 PM Peter Hutterer <peter.hutte...@who-t.net> > wrote: > > > 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 > > > _______________________________________________ > xorg@lists.x.org: X.Org support > Archives: http://lists.freedesktop.org/archives/xorg > Info: https://lists.x.org/mailman/listinfo/xorg > Your subscription address: %(user_address)s _______________________________________________ xorg@lists.x.org: X.Org support Archives: http://lists.freedesktop.org/archives/xorg Info: https://lists.x.org/mailman/listinfo/xorg Your subscription address: %(user_address)s