[Xcb] proto/lib: branches prepared for pulling

Uli Schlachter psychon at znc.in
Sun Aug 11 08:59:15 PDT 2013


On 11.08.2013 17:29, Daniel Martin wrote:
> On Sun, Aug 11, 2013 at 04:22:30PM +0200, Uli Schlachter wrote:
>> On 11.08.2013 15:51, Daniel Martin wrote:
[...]
>>>   * XInput series:
>>>       xcb_util: Add xcb_popcount_len()
>>
>> NAK. I can't see why this would belong into libxcb. We only have xcb_popcount()
>> because the extensions need it to properly serialize requests.
> 
> In XI2 there're a lot of lists of masks followed by list of values. The
> length of the list of values is the sum of popcount() on the masks.
> 
> I.e. valuator_mask + axisvalues in the KeyPress event:
> 
>     <event name="KeyPress" number="2" xge="true">
>         <field type="DeviceId"  name="deviceid" altenum="Device" />
>         <field type="TIMESTAMP" name="time" altenum="Time" />
>         <!-- event specific fields -->
>         <field type="CARD32"    name="detail" />
>         <field type="WINDOW"    name="root" />
>         <field type="WINDOW"    name="event" />
>         <field type="WINDOW"    name="child" />
>         <!-- 32 byte boundary -->
>         <field type="FP1616"    name="root_x" />
>         <field type="FP1616"    name="root_y" />
>         <field type="FP1616"    name="event_x" />
>         <field type="FP1616"    name="event_y" />
>         <field type="CARD16"    name="buttons_len" />
>         <field type="CARD16"    name="valuators_len" />
>         <field type="DeviceId"  name="sourceid" altenum="Device" />
>         <pad bytes="2" />
>         <field type="CARD32"       name="flags" mask="KeyEventFlags" />
>         <field type="ModifierInfo" name="mods" />
>         <field type="GroupInfo"    name="group" />
>         <list type="CARD32" name="button_mask">
>             <fieldref>buttons_len</fieldref>
>         </list>
>         <list type="CARD32" name="valuator_mask"> <---+
>             <fieldref>valuators_len</fieldref>        | popcount() on
>         </list>                                       | masks in a list
>         <list type="FP3232" name="axisvalues">        |
>             <popcount ref="valuator_mask" /> ---------+
>         </list>
>     </event>
> 
> Or do you mean that I should generate code to iterate over the list of
> masks and call xcb_popcount() directly?
[...]

Urgh, I see. Sorry, I thought you wanted to use that function externally.
However, is this the only place where something like this might be needed? This
is just an ugly special case for XKB? :-(

Just to make sure that I understand the XML correctly:

valuators_len is at a fixed position and describes the number of entries in the
valuators_mask list. This list contains lengths of other lists, each of which is
directly after the valuator_mask list? Sounds complicated.

Also, this means we will have <popcount><fieldref>foo</fieldref></popcount> and
<popcount ref="foo" /> looking and meaning almost the same.

I have no clue about the XML and even less clue about the code generator, but
wouldn't this be better handled without introducing <popcount ref="foo">? If the
"normal" popcount refers to a list, the special magic for this is meant,
otherwise the current meaning is used.

This new syntax just exists to simplify the patch to the code generator, right?

Anyway, feel free to ignore me on this; I don't know python, I don't know the
code generator and I don't really know much about the XML in proto.

Cheers,
Uli
-- 
If you ask me to debug your code, I'm going to mail you spiders.


More information about the Xcb mailing list