[Xcb] XKEYBOARD protocol definition

Peter Harris pharris at opentext.com
Wed Nov 11 15:45:00 PST 2009

Josh Triplett wrote:
> On Wed, Nov 11, 2009 at 04:41:06PM -0500, Peter Harris wrote:
>> Eamon Walsh wrote:
>>> Going off on a tangent here: if popcount goes in, then we don't need the
>>> <valueparam> element in the schema anymore.  The reason is that the
>>> following two snippets are identical:
>>> <valueparam value-mask-type="CARD32"
>>>             value-mask-name="value-mask"
>>>             value-list-name="value-list" />
>>> <field type="CARD32" name="value-mask" />
>>> <list name="value-list" type="CARD32">
>>>   <popcount><fieldref>value-mask</fieldref></popcount>
>>> </list>
> Yes, *please*.  I'd love to see valueparam die in favor of something
> simpler and more general.
>> All true. Even better would be to use
>> <switch>(<bitcase></bitcase)+</switch> to replace valueparam, to allow
>> generation of code that replaces xcb/util/aux.
> Both seem useful, I think, depending on the situation.  If you truly
> just have a set of identical values and a bitmask indicating which ones
> you've supplied, a list with length given by a <popcount> seems perfect.


> If you want to supply slightly different values for different cases, or
> otherwise do anything out of the ordinary, <bitcase> seems preferable.
> Can you give an example of replacing a standard <valueparam> with
> <bitcase>?

By using <bitcase>, you can vary the type of the data used. In a
hypothetical future server-side XCB, you could auto-generate boilerplate
that checks to make sure that CreateWindow/BorderPixmap is, in fact, a
valid Pixmap XID. This may also be useful for type-checking bindings
(perhaps Haskell - Antoine?).

For a slightly less hypothetical example, you can link the appropriate
enums to individual fields. This will let the Wireshark dissector
pretty-print RENDER/ChangePicture/repeat as "RepeatReflect" instead of
"3". Once I update the wireshark dissector generator, that is. (RENDER
example used instead of CreateWindow, since core X11 is still dissected
by the legacy X11 dissector in Wireshark.)

Peter Harris
               Open Text Connectivity Solutions Group
Peter Harris                    http://connectivity.opentext.com/
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866

More information about the Xcb mailing list