[Xcb] Enumerations and typed valueparams (was: XKB once again ...)

Peter Harris peter.harris at hummingbird.com
Mon Jan 14 07:55:12 PST 2008


Barton C Massey wrote:
> I'm with both of you: we need to find a better XML encoding
> for the information you've captured, that doesn't require
> string mangling to decode.  The "obvious" thing is
>   <bit name="back_pixmap" index="2" type="pixmap"
>        when0="None" when1="ParentRelative" />

That still hard-codes "None" and "ParentRelative" into each bit that 
needs to respect those. It also breaks the current code generators that 
expect <item name="foo"><bit>bar</bit></item>, although I suppose if you 
want to break everything, it's better to do so sooner than later.

Just brainstorming here:

<enum name="BackPixmap" type="PIXMAP">
  <!-- The rest of this enum is unchanged -->
  <item name="None">          <value>0</value></item>
  <item name="ParentRelative"><value>1</value></item>
</enum>

<enum name="CW">
  <item name="BackPixmap"   type="BackPixmap"><bit>0</bit></item>
  <item name="BackPixel"    type="CARD32">    <bit>1</bit></item>
  <item name="BorderPixmap" type="BackPixmap"><bit>2</bit></item>
  <!-- and so on -->

This makes it clear that the enum only applies to certain values, and 
the rest of the time the value should be treated as a PIXMAP. Or am I 
out in left field?

While we're talking about enums, xproto.xml contains ModMask and 
ButtonMask, but nothing that matches KEYBUTMASK. Brainstorming again:

<enum name="KeyButMask">
  <item><enum="ModMask></item>
  <item><enum="ButtonMask></item>
</enum>

Or would it be better to just write out a new KeyButtonMask that 
coincidentally happens to contain all the elements of ModMask and 
ButtonMask?

Peter Harris
-- 
      Hummingbird Connectivity - A Division of Open Text
Peter Harris                    http://connectivity.hummingbird.com
Research and Development        Phone: +1 905 762 6001
peter.harris at hummingbird.com    Toll Free: 1 877 359 4866


More information about the Xcb mailing list