xinput: struct FeedbackState: full support
[free-sw/xcb/proto] / src / xinput.xml
index 39b26e9..c7e57a5 100644 (file)
@@ -32,6 +32,65 @@ authorization from the authors.
      http://cgit.freedesktop.org/xorg/proto/inputproto/tree/specs/XI2proto.txt
 -->
 
+<!-- TODO: Things which need to be done for full XInput support
+       but cannot be done now ( August 18, 2014 ) with the current feature-set
+       of the xml and the generator:
+
+*****
+
+replace "uninterpreted_data" or similar constructs
+with a semantic that shows how to interpret this data.
+This requires enhancements to the xml-schema and generator such as union with selector.
+
+This will, e.g., be necessary for automatically generated byte-order conversion code,
+which will, e.g., be necessary for server-side xcb.
+
+This affects the following:
+* ChangeFeedbackControl request field "feedback" ( structs FeedbackCtl, ... )
+* QueryDeviceState reply field "classes" ( structs InputState, ... )
+* GetDeviceControl reply field "control"  ( structs DeviceState, ... )
+* ChangeDeviceControl request field "control" ( structs ChangeDeviceControl, ... )
+* XIChangeHierarchy request field "changes" ( structs  HierarchyChange, ... )
+* 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
+"num_axes" of the GetDeviceMotionEvents-reply
+in struct DeviceTimeCoord.
+
+*****
+
+-->
+
+
 <xcb header="xinput" extension-xname="XInputExtension" extension-name="Input"
      major-version="2" minor-version="3">
     <import>xfixes</import>
@@ -115,48 +174,38 @@ authorization from the authors.
         <pad bytes="1" />
     </struct>
 
-    <struct name="KeyInfo">
-        <field type="CARD8"   name="class_id" enum="InputClass" />
-        <field type="CARD8"   name="len" />
-        <field type="KeyCode" name="min_keycode" />
-        <field type="KeyCode" name="max_keycode" />
-        <field type="CARD16"  name="num_keys" />
-        <pad bytes="2" />
-    </struct>
-
-    <struct name="ButtonInfo">
-        <field type="CARD8"  name="class_id" enum="InputClass" />
-        <field type="CARD8"  name="len" />
-        <field type="CARD16" name="num_buttons" />
-    </struct>
-
     <struct name="AxisInfo">
         <field type="CARD32" name="resolution" />
         <field type="INT32"  name="minimum" />
         <field type="INT32"  name="maximum" />
     </struct>
 
-    <struct name="ValuatorInfo">
-        <field type="CARD8"   name="class_id" enum="InputClass" />
-        <field type="CARD8"   name="len" />
-        <field type="CARD8"   name="axes_len" />
-        <field type="CARD8"   name="mode" enum="ValuatorMode" />
-        <field type="CARD32"  name="motion_size" />
-        <list type="AxisInfo" name="axes">
-            <fieldref>axes_len</fieldref>
-        </list>
-    </struct>
-
     <struct name="InputInfo">
         <field type="CARD8" name="class_id" enum="InputClass" />
         <field type="CARD8" name="len" />
-    </struct>
-
-    <struct name="DeviceName">
-        <field type="CARD8" name="len" />
-        <list type="char"  name="string">
-            <fieldref>len</fieldref>
-        </list>
+        <switch name="info">
+            <fieldref>class_id</fieldref>
+            <case name="key">
+                <enumref ref="InputClass">Key</enumref>
+                <field type="KeyCode" name="min_keycode" />
+                <field type="KeyCode" name="max_keycode" />
+                <field type="CARD16"  name="num_keys" />
+                <pad bytes="2" />
+            </case>
+            <case name="button">
+                <enumref ref="InputClass">Button</enumref>
+                <field type="CARD16"    name="num_buttons" />
+            </case>
+            <case name="valuator">
+                <enumref ref="InputClass">Valuator</enumref>
+                <field type="CARD8"   name="axes_len" />
+                <field type="CARD8"   name="mode" enum="ValuatorMode" />
+                <field type="CARD32"  name="motion_size" />
+                <list type="AxisInfo" name="axes">
+                    <fieldref>axes_len</fieldref>
+                </list>
+            </case>
+       </switch>
     </struct>
 
     <request name="ListInputDevices" opcode="2">
@@ -167,9 +216,15 @@ authorization from the authors.
             <list type="DeviceInfo" name="devices">
                 <fieldref>devices_len</fieldref>
             </list>
-            <!-- Uninterpreted: list (infos) of InputInfo structures,
-                                length is <sumof> all devices.num_class_info -->
-            <!-- Uninterpreted: list (name) of DeviceName structures -->
+            <list type="InputInfo" name="infos">
+                <sumof ref="devices">
+                       <fieldref>num_class_info</fieldref>
+               </sumof>
+            </list>
+            <list type="STR" name="names">
+                <fieldref>devices_len</fieldref>
+            </list>
+            <pad align="4" />
         </reply>
     </request>
 
@@ -542,12 +597,56 @@ authorization from the authors.
         <field type="CARD8"  name="class_id" enum="FeedbackClass" />
         <field type="CARD8"  name="feedback_id" />
         <field type="CARD16" name="len" />
-        <list type="CARD8" name="uninterpreted_data">
-            <op op="-">
-                <fieldref>len</fieldref>
-                <value>4</value>
-            </op>
-        </list>
+        <switch name="data">
+            <fieldref>class_id</fieldref>
+            <case name="keyboard">
+                <enumref ref="FeedbackClass">Keyboard</enumref>
+                <field type="CARD16" name="pitch" />
+                <field type="CARD16" name="duration" />
+                <field type="CARD32" name="led_mask" />
+                <field type="CARD32" name="led_values" />
+                <field type="BOOL"   name="global_auto_repeat" />
+                <field type="CARD8"  name="click" />
+                <field type="CARD8"  name="percent" />
+                <pad bytes="1" />
+                <list type="CARD8" name="auto_repeats">
+                    <value>32</value>
+                </list>
+            </case>
+            <case name="pointer">
+                <enumref ref="FeedbackClass">Pointer</enumref>
+                <pad bytes="2" />
+                <field type="CARD16" name="accel_num" />
+                <field type="CARD16" name="accel_denom" />
+                <field type="CARD16" name="threshold" />
+            </case>
+            <case name="string">
+                <enumref ref="FeedbackClass">String</enumref>
+                <field type="CARD16" name="max_symbols" />
+                <field type="CARD16" name="num_keysyms" />
+                <list type="KEYSYM"  name="keysyms">
+                   <fieldref>num_keysyms</fieldref>
+               </list>
+            </case>
+            <case name="integer">
+                <enumref ref="FeedbackClass">Integer</enumref>
+                <field type="CARD32" name="resolution" />
+                <field type="INT32"  name="min_value" />
+                <field type="INT32"  name="max_value" />
+            </case>
+            <case name="led">
+                <enumref ref="FeedbackClass">Led</enumref>
+                <field type="CARD32" name="led_mask" />
+                <field type="CARD32" name="led_values" />
+            </case>
+            <case name="bell">
+                <enumref ref="FeedbackClass">Bell</enumref>
+                <field type="CARD8"  name="percent" />
+                <pad bytes="3" />
+                <field type="CARD16" name="pitch" />
+                <field type="CARD16" name="duration" />
+            </case>
+        </switch>
     </struct>
 
     <request name="GetFeedbackControl" opcode="22">
@@ -795,7 +894,7 @@ authorization from the authors.
         <field type="CARD8" name="len" />
         <field type="CARD8" name="num_valuators" />
         <field type="CARD8" name="mode" mask="ValuatorStateModeMask" />
-        <list type="CARD32" name="valuators">
+        <list type="INT32" name="valuators">
             <fieldref>num_valuators</fieldref>
         </list>
     </struct>
@@ -803,14 +902,33 @@ authorization from the authors.
     <struct name="InputState">
         <field type="CARD8" name="class_id" enum="InputClass" />
         <field type="CARD8" name="len" />
-        <field type="CARD8" name="num_items" />
-        <pad bytes="1" />
-        <list type="CARD8" name="uninterpreted_data">
-            <op op="-">
-                <fieldref>len</fieldref>
-                <value>4</value>
-            </op>
-        </list>
+        <switch name="data">
+            <fieldref>class_id</fieldref>
+            <case name="key">
+                <enumref ref="InputClass">Key</enumref>
+                <field type="CARD8" name="num_keys" />
+                <pad bytes="1" />
+                <list type="CARD8" name="keys">
+                    <value>32</value>
+                </list>
+            </case>
+            <case name="button">
+                <enumref ref="InputClass">Button</enumref>
+                <field type="CARD8" name="num_buttons" />
+                <pad bytes="1" />
+                <list type="CARD8" name="buttons">
+                    <value>32</value>
+                </list>
+            </case>
+            <case name="valuator">
+                <enumref ref="InputClass">Valuator</enumref>
+                <field type="CARD8" name="num_valuators" />
+                <field type="CARD8" name="mode" mask="ValuatorStateModeMask" />
+                <list type="INT32" name="valuators">
+                    <fieldref>num_valuators</fieldref>
+                </list>
+            </case>
+        </switch>
     </struct>
 
     <request name="QueryDeviceState" opcode="30">
@@ -1068,30 +1186,26 @@ authorization from the authors.
         <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>
                 <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>
     </request>