[Xcb] proto/lib: branches prepared for pulling

Daniel Martin consume.noise at gmail.com
Sun Aug 11 10:35:52 PDT 2013


On Sun, Aug 11, 2013 at 05:59:15PM +0200, Uli Schlachter wrote:
> 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? :-(

If I counted correctly (well I cheated and included eventcopys): this
affects 16 out of 25 events in the XInput extension v2++.

> 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.

Yes.

> This list contains lengths of other lists, each of which is directly
> after the valuator_mask list? Sounds complicated.

No. There is only one list after the valuator_mask list, that is
axisvalues.

The valuator_mask list represents a long bit mask (of linked CARD32s).
Each set bit in the mask represents a valuator. Additionally, each set
bit says that there'll be one axis value for this valuator in the
axisvalues list.

If you want to look at those valuators and axis values:
- pick the device id of your pointer device out of `xinput list`
- pass the id to `xinput list --long $DEVID`
-> Within the output you'll see XIValuatorClass entries, the valuators.

- if you pass the id to `xinput test-xi2 $DEVID`
- touch/move the pointer
-> Watch out for 'Motion' events, there you've 'valuators:' at the end.

> 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?

Yes, using the fieldref would've been better and yes it's the code
generators fault, not mine. ;) I'll review it. But, I'm afraid of the
resulting patch, I assume it'll look like a mess.

> 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