schema: add paramref
[free-sw/xcb/proto] / src / xinput.xml
index 1909a23..c569257 100644 (file)
@@ -46,36 +46,10 @@ This will, e.g., be necessary for automatically generated byte-order conversion
 which will, e.g., be necessary for server-side xcb.
 
 This affects the following:
-* QueryDeviceState reply field "classes" ( structs InputState, ... )
-* struct XIDeviceInfo field "classes" ( structs DeviceClass, ... )
 * SendExtensionEvent member "events"
 
 *****
 
-xml and generator have to support <popcount> of all members of a list
-
-This is needed for the following XI2-events ( and eventcopies thereof )
-       KeyPress
-       ButtonPress
-       RawKeyPress
-       RawKeyPress
-       RawButtonPress
-       TouchBegin
-       RawTouchBegin
-
-*****
-
-xml and generator should support
-switch-case similar to switch-bitcase.
-
-(and maybe: variable sized unions with a mechanism to define
-which union-field is selected.)
-
-One of these features is needed for the InputInfo type
-which is used by request "ListInputDevices" for the list "input_infos".
-
-*****
-
 Parametrized structs
 
 This is needed for being able to use the value of the field
@@ -1382,30 +1356,26 @@ in struct DeviceTimeCoord.
             <pad bytes="10" />
             <switch name="items">
                 <fieldref>format</fieldref>
-                <!-- <bitcase> is not correct, this would need <cases>s.
-                     It works in that case, because PropertyFormat items can be
-                     distinguished exactly as their values don't have equal bits.
-                -->
-                <bitcase>
+                <case>
                     <enumref ref="PropertyFormat">8Bits</enumref>
                     <list type="CARD8" name="data8">
                         <fieldref>num_items</fieldref>
                     </list>
                     <pad align="4" />
-                </bitcase>
-                <bitcase>
+                </case>
+                <case>
                     <enumref ref="PropertyFormat">16Bits</enumref>
                     <list type="CARD16" name="data16">
                         <fieldref>num_items</fieldref>
                     </list>
                     <pad align="4" />
-                </bitcase>
-                <bitcase>
+                </case>
+                <case>
                     <enumref ref="PropertyFormat">32Bits</enumref>
                     <list type="CARD32" name="data32">
                         <fieldref>num_items</fieldref>
                     </list>
-                </bitcase>
+                </case>
             </switch>
         </reply>
     </request>
@@ -1759,16 +1729,56 @@ in struct DeviceTimeCoord.
         <field type="CARD16"   name="type" enum="DeviceClassType" />
         <field type="CARD16"   name="len" />
         <field type="DeviceId" name="sourceid" />
-        <pad bytes="2" />
-        <list type="CARD8" name="uninterpreted_data">
-            <op op="-">
-                <op op="*">
-                    <fieldref>len</fieldref>
-                    <value>4</value>
-                </op>
-                <value>8</value>
-            </op>
-        </list>
+       <switch name="data">
+           <fieldref>type</fieldref>
+           <case name="key">
+               <enumref ref="DeviceClassType">Key</enumref>
+               <field type="CARD16"   name="num_keys" />
+               <list type="CARD32" name="keys">
+                   <fieldref>num_keys</fieldref>
+               </list>
+           </case>
+           <case name="button">
+               <enumref ref="DeviceClassType">Button</enumref>
+               <field type="CARD16"   name="num_buttons" />
+               <list type="CARD32"    name="state">
+                   <op op="/">
+                       <op op="+">
+                           <fieldref>num_buttons</fieldref>
+                           <value>31</value>
+                       </op>
+                       <value>32</value>
+                   </op>
+               </list>
+               <list type="ATOM" name="labels">
+                   <fieldref>num_buttons</fieldref>
+               </list>
+           </case>
+           <case name="valuator">
+               <enumref ref="DeviceClassType">Valuator</enumref>
+               <field type="CARD16"   name="number" />
+               <field type="ATOM"     name="label" />
+               <field type="FP3232"   name="min" />
+               <field type="FP3232"   name="max" />
+               <field type="FP3232"   name="value" />
+               <field type="CARD32"   name="resolution" />
+               <field type="CARD8"    name="mode" enum="ValuatorMode" />
+               <pad bytes="3" />
+           </case>
+           <case name="scroll">
+               <enumref ref="DeviceClassType">Scroll</enumref>
+               <field type="CARD16"   name="number" />
+               <field type="CARD16"   name="scroll_type" enum="ScrollType" />
+               <pad bytes="2" />
+               <field type="CARD32"   name="flags" mask="ScrollFlags" />
+               <field type="FP3232"   name="increment" />
+           </case>
+           <case name="touch">
+               <enumref ref="DeviceClassType">Touch</enumref>
+               <field type="CARD8"    name="mode" enum="TouchMode" />
+               <field type="CARD8"    name="num_touches" />
+           </case>
+       </switch>
     </struct>
 
     <struct name="XIDeviceInfo">
@@ -1975,28 +1985,24 @@ in struct DeviceTimeCoord.
         <field type="CARD32"   name="num_items" />
         <switch name="items">
             <fieldref>format</fieldref>
-            <!-- <bitcase> is not correct, this would need <cases>s.
-                 It works in that case, because PropertyFormat items can be
-                 distinguished exactly as their values don't have equal bits.
-            -->
-            <bitcase>
+            <case>
                 <enumref ref="PropertyFormat">8Bits</enumref>
                 <list type="CARD8" name="data8">
                     <fieldref>num_items</fieldref>
                 </list>
-            </bitcase>
-            <bitcase>
+            </case>
+            <case>
                 <enumref ref="PropertyFormat">16Bits</enumref>
                 <list type="CARD16" name="data16">
                     <fieldref>num_items</fieldref>
                 </list>
-            </bitcase>
-            <bitcase>
+            </case>
+            <case>
                 <enumref ref="PropertyFormat">32Bits</enumref>
                 <list type="CARD32" name="data32">
                     <fieldref>num_items</fieldref>
                 </list>
-            </bitcase>
+            </case>
         </switch>
     </request>
 
@@ -2027,30 +2033,26 @@ in struct DeviceTimeCoord.
             <pad bytes="11" />
             <switch name="items">
                 <fieldref>format</fieldref>
-                <!-- <bitcase> is not correct, this would need <cases>s.
-                     It works in that case, because PropertyFormat items can be
-                     distinguished exactly as their values don't have equal bits.
-                -->
-                <bitcase>
+                <case>
                     <enumref ref="PropertyFormat">8Bits</enumref>
                     <list type="CARD8" name="data8">
                         <fieldref>num_items</fieldref>
                     </list>
                     <pad align="4" />
-                </bitcase>
-                <bitcase>
+                </case>
+                <case>
                     <enumref ref="PropertyFormat">16Bits</enumref>
                     <list type="CARD16" name="data16">
                         <fieldref>num_items</fieldref>
                     </list>
                     <pad align="4" />
-                </bitcase>
-                <bitcase>
+                </case>
+                <case>
                     <enumref ref="PropertyFormat">32Bits</enumref>
                     <list type="CARD32" name="data32">
                         <fieldref>num_items</fieldref>
                     </list>
-                </bitcase>
+                </case>
             </switch>
         </reply>
     </request>
@@ -2291,8 +2293,13 @@ in struct DeviceTimeCoord.
         <list type="CARD32" name="valuator_mask">
             <fieldref>valuators_len</fieldref>
         </list>
-        <!-- Uninterpreted: list (axisvalues) of FP3232,
-                            length is <popcount> on valuator_mask list -->
+        <list type="FP3232" name="axisvalues">
+            <sumof ref="valuator_mask">
+                <popcount>
+                    <listelement-ref/>
+                </popcount>
+            </sumof>
+        </list>
     </event>
 
     <eventcopy name="KeyRelease" number="3" ref="KeyPress" />
@@ -2327,8 +2334,13 @@ in struct DeviceTimeCoord.
         <list type="CARD32" name="valuator_mask">
             <fieldref>valuators_len</fieldref>
         </list>
-        <!-- Uninterpreted: list (axisvalues) of FP3232,
-                            length is <popcount> on valuator_mask list -->
+        <list type="FP3232" name="axisvalues">
+            <sumof ref="valuator_mask">
+                <popcount>
+                    <listelement-ref/>
+                </popcount>
+            </sumof>
+        </list>
     </event>
 
     <eventcopy name="ButtonRelease" number="5" ref="ButtonPress" />
@@ -2447,10 +2459,20 @@ in struct DeviceTimeCoord.
         <list type="CARD32" name="valuator_mask">
             <fieldref>valuators_len</fieldref>
         </list>
-        <!-- Uninterpreted: list (axisvalues) of FP3232,
-                            length is <popcount> on valuator_mask list -->
-        <!-- Uninterpreted: list (axisvalues_raw) of FP3232,
-                            length is <popcount> on valuator_mask list -->
+        <list type="FP3232" name="axisvalues">
+            <sumof ref="valuator_mask">
+                <popcount>
+                    <listelement-ref/>
+                </popcount>
+            </sumof>
+        </list>
+        <list type="FP3232" name="axisvalues_raw">
+            <sumof ref="valuator_mask">
+                <popcount>
+                    <listelement-ref/>
+                </popcount>
+            </sumof>
+        </list>
     </event>
 
     <eventcopy name="RawKeyRelease" number="14" ref="RawKeyPress" />
@@ -2468,10 +2490,20 @@ in struct DeviceTimeCoord.
         <list type="CARD32" name="valuator_mask">
             <fieldref>valuators_len</fieldref>
         </list>
-        <!-- Uninterpreted: list (axisvalues) of FP3232,
-                            length is <popcount> on valuator_mask list -->
-        <!-- Uninterpreted: list (axisvalues_raw) of FP3232,
-                            length is <popcount> on valuator_mask list -->
+        <list type="FP3232" name="axisvalues">
+            <sumof ref="valuator_mask">
+                <popcount>
+                    <listelement-ref/>
+                </popcount>
+            </sumof>
+        </list>
+        <list type="FP3232" name="axisvalues_raw">
+            <sumof ref="valuator_mask">
+                <popcount>
+                    <listelement-ref/>
+                </popcount>
+            </sumof>
+        </list>
     </event>
 
     <eventcopy name="RawButtonRelease" number="16" ref="RawButtonPress" />
@@ -2510,8 +2542,13 @@ in struct DeviceTimeCoord.
         <list type="CARD32" name="valuator_mask">
             <fieldref>valuators_len</fieldref>
         </list>
-        <!-- Uninterpreted: list (axisvalues) of FP3232,
-                            length is <popcount> on valuator_mask list -->
+        <list type="FP3232" name="axisvalues">
+            <sumof ref="valuator_mask">
+                <popcount>
+                    <listelement-ref/>
+                </popcount>
+            </sumof>
+        </list>
     </event>
 
     <eventcopy name="TouchUpdate" number="19" ref="TouchBegin" />
@@ -2550,10 +2587,20 @@ in struct DeviceTimeCoord.
         <list type="CARD32" name="valuator_mask">
             <fieldref>valuators_len</fieldref>
         </list>
-        <!-- Uninterpreted: list (axisvalues) of FP3232,
-                            length is <popcount> on valuator_mask list -->
-        <!-- Uninterpreted: list (axisvalues_raw) of FP3232,
-                            length is <popcount> on valuator_mask list -->
+        <list type="FP3232" name="axisvalues">
+            <sumof ref="valuator_mask">
+                <popcount>
+                    <listelement-ref/>
+                </popcount>
+            </sumof>
+        </list>
+        <list type="FP3232" name="axisvalues_raw">
+            <sumof ref="valuator_mask">
+                <popcount>
+                    <listelement-ref/>
+                </popcount>
+            </sumof>
+        </list>
     </event>
 
     <eventcopy name="RawTouchUpdate" number="23" ref="RawTouchBegin" />