xinput: rep XIGetProperty: replace bitcase with case
[free-sw/xcb/proto] / src / xinput.xml
index 3c36c0b..b5e22a0 100644 (file)
@@ -46,9 +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, ... )
-* XIChangeHierarchy request field "changes" ( structs  HierarchyChange, ... )
-* struct XIDeviceInfo field "classes" ( structs DeviceClass, ... )
 * SendExtensionEvent member "events"
 
 *****
@@ -66,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
@@ -1383,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>
@@ -1534,15 +1516,37 @@ in struct DeviceTimeCoord.
     <struct name="HierarchyChange">
         <field type="CARD16" name="type" enum="HierarchyChangeType" />
         <field type="CARD16" name="len" />
-        <list type="CARD8" name="uninterpreted_data">
-            <op op="-">
-                <op op="*">
-                    <fieldref>len</fieldref>
-                    <value>4</value>
-                </op>
-                <value>4</value>
-            </op>
-        </list>
+        <switch name="data">
+            <fieldref>type</fieldref>
+            <case name="add_master">
+                <enumref ref="HierarchyChangeType">AddMaster</enumref>
+                <field type="CARD16" name="name_len" />
+                <field type="BOOL"   name="send_core" />
+                <field type="BOOL"   name="enable" />
+                <list type="char" name="name">
+                    <fieldref>name_len</fieldref>
+                </list>
+                <pad align="4" />
+            </case>
+            <case name="remove_master">
+                <enumref ref="HierarchyChangeType">RemoveMaster</enumref>
+                <field type="DeviceId" name="deviceid" altenum="Device" />
+                <field type="CARD8"    name="return_mode" enum="ChangeMode" />
+                <pad bytes="1" />
+                <field type="DeviceId" name="return_pointer" altenum="Device" />
+                <field type="DeviceId" name="return_keyboard" altenum="Device" />
+            </case>
+            <case name="attach_slave">
+                <enumref ref="HierarchyChangeType">AttachSlave</enumref>
+                <field type="DeviceId" name="deviceid" altenum="Device" />
+                <field type="DeviceId" name="master" altenum="Device" />
+            </case>
+            <case name="detach_slave">
+                <enumref ref="HierarchyChangeType">DetachSlave</enumref>
+                <field type="DeviceId" name="deviceid" altenum="Device" />
+                <pad bytes="2" />
+            </case>
+        </switch>
     </struct>
 
     <request name="XIChangeHierarchy" opcode="43">
@@ -1738,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">
@@ -1954,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>
 
@@ -2006,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>