xinput: rep XIGetProperty: replace bitcase with case
[free-sw/xcb/proto] / src / xinput.xml
index 1909a23..b5e22a0 100644 (file)
@@ -46,8 +46,6 @@ 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"
 
 *****
@@ -65,17 +63,6 @@ This is needed for the following XI2-events ( and eventcopies thereof )
 
 *****
 
-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 +1369,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 +1742,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 +1998,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 +2046,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>