[Xcb] How do I distinguish XKB events?

Klemens Baum klemensbaum at gmail.com
Tue Dec 29 05:04:51 PST 2015


On Mon, Dec 28, 2015 at 7:15 PM,  <me at beroal.in.ua> wrote:
> So how do I distinguish XKB events?

This seems to be an omission from XCB. Most projects seem to work
around it by checking the pad0 member in xcb_generic_event_t (as seen
here: https://github.com/wxg4net/awesome-src/blob/8c0c2e8f56c6e269e7a3c11f66f95fb2f3751e76/xkb.c#L123)
or by defining their own generic struct
(https://github.com/andrenho/perminal/blob/f7406f3f4f4c95c54e0cc668593b114226cdcb4f/.old/cpp/frontend/xkb_keyboard.cc#L212).

To prepare a patch, we would first need to decide which header the
generic XKB struct should go into. As far as I know xcb/xkb.h is
entirely auto-generated, so if it should go in there we could add an
<event name="GenericEvent"> to proto/src/xkb.xml. But events list an
opcode in the `number' attribute, and c_client.py seems to assume this
is always the case in order to generate the corresponding #define. So
c_client.py would need an additional conditional check for events that
do not have an opcode.
Alternatively, it could go into xcb.h, which can be manually edited.

What do others think?


More information about the Xcb mailing list