[Xcb] [PATCH] XKB: Fix broken events

Josh Triplett josh at joshtriplett.org
Thu Jun 21 12:24:12 PDT 2012


On Thu, Jun 21, 2012 at 07:16:34PM +0100, Daniel Stone wrote:
> On 21 June 2012 18:56, Josh Triplett <josh at joshtriplett.org> wrote:
> > On Thu, Jun 21, 2012 at 12:40:02PM +0100, Daniel Stone wrote:
> >> -     <event name="NewKeyboardNotify" number="0">
> >> +     <event name="NewKeyboardNotify" number="0" no-sequence-number="true">
> >> +             <field name="xkbType" type="CARD8" />
> >> +             <field name="sequence" type="CARD16" />
> >
> > This seems wrong.  Filling in the byte before the sequence number
> > shouldn't require using no-sequence-number.  Among other things,
> > no-sequence-number implies that XCB can't use the event for
> > sequence synchronization; just because you filled in a field named
> > "sequence" in the right place doesn't mean that it has the semantics of
> > a sequence number.
> 
> Ah, I didn't realise it had implications beyond just the naming, my
> bad.  xcbgen seemed to more or less imply that if you had a field
> called pad0 which was CARD8, then it'd write that into the struct.  Is
> this the preferred way, and if so, would you take patches to allow
> using a more descriptive name?

At one point, xcb-proto had the ability to take a one-byte field and put
it in the slot before the sequence number, while still generating the
sequence number field for you.  I don't know if the current version of
xcb-proto has that ability anymore.

> As for the switch - yeah, rather.  I just went for the quickest and
> least likely to cause pain solution right now.  I guess a switch would
> be better, but it does seem pretty monumentally ugly.

The way you wrote it will define the structures correctly, but won't
define the event numbers correctly, and won't allow anything attempting
to decode the response stream to decode these events correctly.  It only
works in the C version because xcb_wait_event can't give you a typed
event structure, so you have to cast it yourself, and you already know
what checks to manually perform to know what type to cast it to.

- Josh Triplett


More information about the Xcb mailing list