xinput: req ChangeDeviceProperty: bitcase to case
[free-sw/xcb/proto] / src / xinput.xml
index 6538726..dc87e78 100644 (file)
@@ -32,6 +32,73 @@ 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:
+* GetFeedbackControl reply field "feedbacks" ( structs FeedbackState, ... )
+* 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
+
+
+*****
+
+<sumof> should support fields of listmembers.
+
+This is needed for request "ListInputDevices"
+
+*****
+
+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>
@@ -63,7 +130,7 @@ authorization from the authors.
             <fieldref>name_len</fieldref>
         </list>
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8"  name="xi_reply_type" />
             <field type="CARD16" name="server_major" />
             <field type="CARD16" name="server_minor" />
             <field type="BOOL"   name="present" />
@@ -161,7 +228,7 @@ authorization from the authors.
 
     <request name="ListInputDevices" opcode="2">
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="devices_len" />
             <pad bytes="23" />
             <list type="DeviceInfo" name="devices">
@@ -184,7 +251,7 @@ authorization from the authors.
         <field type="CARD8" name="device_id" />
         <pad bytes="3" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="num_classes" />
             <pad bytes="23" />
             <list type="InputClassInfo" name="class_info">
@@ -208,8 +275,9 @@ authorization from the authors.
         <field type="CARD8" name="mode" enum="ValuatorMode" />
         <pad bytes="2" />
         <reply>
-            <pad bytes="1" />
-            <field type="CARD8" name="status" altenum="GrabStatus" />
+            <field type="CARD8" name="xi_reply_type" />
+            <!-- values for status: 0: Success, 1: AlreadyGrabbed -->
+            <field type="CARD8" name="status" enum="GrabStatus" />
             <pad bytes="23" />
         </reply>
     </request>
@@ -230,7 +298,7 @@ authorization from the authors.
     <request name="GetSelectedExtensionEvents" opcode="7">
         <field type="WINDOW" name="window" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8"  name="xi_reply_type" />
             <field type="CARD16" name="num_this_classes" />
             <field type="CARD16" name="num_all_classes" />
             <pad bytes="20" />
@@ -265,7 +333,7 @@ authorization from the authors.
     <request name="GetDeviceDontPropagateList" opcode="9">
         <field type="WINDOW" name="window" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8"  name="xi_reply_type" />
             <field type="CARD16" name="num_classes" />
             <pad bytes="22" />
             <list type="EventClass" name="classes">
@@ -288,7 +356,7 @@ authorization from the authors.
         <field type="CARD8"     name="device_id" />
         <pad bytes="3"/>
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8"  name="xi_reply_type" />
             <field type="CARD32" name="num_events" />
             <field type="CARD8"  name="num_axes" />
             <field type="CARD8"  name="device_mode" enum="ValuatorMode" />
@@ -303,7 +371,7 @@ authorization from the authors.
         <field type="CARD8" name="device_id" />
         <pad bytes="3" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <!-- only the following GrabStatus-values are valid here:
                  "Success", "AlreadyGrabbed", and "Frozen"
             -->
@@ -320,7 +388,7 @@ authorization from the authors.
         <field type="CARD8" name="device_id" />
         <pad bytes="1" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <!-- only the following GrabStatus-values are valid here:
                  "Success", "AlreadyGrabbed", and "Frozen"
             -->
@@ -344,7 +412,7 @@ authorization from the authors.
             <fieldref>num_classes</fieldref>
         </list>
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="status" enum="GrabStatus" />
             <pad bytes="23" />
         </reply>
@@ -413,7 +481,7 @@ authorization from the authors.
     <request name="UngrabDeviceButton" opcode="18">
         <field type="WINDOW" name="grab_window" />
         <field type="CARD16" name="modifiers" mask="ModMask" />
-        <field type="CARD8"  name="modifier_device" />
+        <field type="CARD8"  name="modifier_device" altenum="ModifierDevice" />
         <field type="CARD8"  name="button" altenum="Grab" />
         <field type="CARD8"  name="grabbed_device" />
         <pad bytes="3" />
@@ -443,7 +511,7 @@ authorization from the authors.
         <field type="CARD8" name="device_id" />
         <pad bytes="3" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8"     name="xi_reply_type" />
             <field type="WINDOW"    name="focus" altenum="InputFocus" />
             <field type="TIMESTAMP" name="time" />
             <field type="CARD8"     name="revert_to" enum="InputFocus" />
@@ -553,7 +621,7 @@ authorization from the authors.
         <field type="CARD8" name="device_id" />
         <pad bytes="3" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8"  name="xi_reply_type" />
             <field type="CARD16" name="num_feedbacks" />
             <pad bytes="22" />
             <list type="FeedbackState" name="feedbacks">
@@ -636,8 +704,24 @@ authorization from the authors.
         </list>
     </struct>
 
+    <enum name="ChangeFeedbackControlMask">
+        <item name="KeyClickPercent">  <bit>0</bit> </item> <!-- 0x01 -->
+        <item name="Percent">          <bit>1</bit> </item> <!-- 0x02 -->
+        <item name="Pitch">            <bit>2</bit> </item> <!-- 0x04 -->
+        <item name="Duration">         <bit>3</bit> </item> <!-- 0x08 -->
+        <item name="Led">              <bit>4</bit> </item> <!-- 0x10 -->
+        <item name="LedMode">          <bit>5</bit> </item> <!-- 0x20 -->
+        <item name="Key">              <bit>6</bit> </item> <!-- 0x40 -->
+        <item name="AutoRepeatMode">   <bit>7</bit> </item> <!-- 0x80 -->
+        <item name="String">           <bit>0</bit> </item> <!-- 0x01 -->
+        <item name="Integer">          <bit>0</bit> </item> <!-- 0x01 -->
+        <item name="AccelNum">         <bit>0</bit> </item> <!-- 0x01 -->
+        <item name="AccelDenom">       <bit>1</bit> </item> <!-- 0x02 -->
+        <item name="Threshold">        <bit>2</bit> </item> <!-- 0x04 -->
+    </enum>
+
     <request name="ChangeFeedbackControl" opcode="23">
-        <field type="CARD32"      name="mask" />
+        <field type="CARD32"      name="mask" mask="ChangeFeedbackControlMask" />
         <field type="CARD8"       name="device_id" />
         <field type="CARD8"       name="feedback_id" />
         <pad bytes="2" />
@@ -652,7 +736,7 @@ authorization from the authors.
         <field type="CARD8"   name="count" />
         <pad bytes="1" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="keysyms_per_keycode" />
             <pad bytes="23" />
             <list type="KEYSYM" name="keysyms">
@@ -683,7 +767,7 @@ authorization from the authors.
         <field type="CARD8" name="device_id" />
         <pad bytes="3" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="keycodes_per_modifier" />
             <pad bytes="23" />
             <list type="CARD8"  name="keymaps">
@@ -708,7 +792,7 @@ authorization from the authors.
             </op>
         </list>
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="status" enum="MappingStatus" />
             <pad bytes="23" />
         </reply>
@@ -720,7 +804,7 @@ authorization from the authors.
         <field type="CARD8" name="device_id" />
         <pad bytes="3" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="map_size" />
             <pad bytes="23" />
             <list type="CARD8" name="map">
@@ -740,7 +824,7 @@ authorization from the authors.
             <fieldref>map_size</fieldref>
         </list>
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="status" enum="MappingStatus" />
             <pad bytes="23" />
         </reply>
@@ -768,11 +852,16 @@ authorization from the authors.
         </list>
     </struct>
 
+    <enum name="ValuatorStateModeMask">
+        <item name="DeviceModeAbsolute"> <bit>0</bit> </item>
+        <item name="OutOfProximity">     <bit>1</bit> </item>
+    </enum>
+
     <struct name="ValuatorState">
         <field type="CARD8" name="class_id" enum="InputClass" />
         <field type="CARD8" name="len" />
         <field type="CARD8" name="num_valuators" />
-        <field type="CARD8" name="mode" />
+        <field type="CARD8" name="mode" mask="ValuatorStateModeMask" />
         <list type="CARD32" name="valuators">
             <fieldref>num_valuators</fieldref>
         </list>
@@ -795,7 +884,7 @@ authorization from the authors.
         <field type="CARD8" name="device_id" />
         <pad bytes="3" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="num_classes" />
             <pad bytes="23" />
             <list type="InputState" name="classes">
@@ -844,7 +933,7 @@ authorization from the authors.
             <fieldref>num_valuators</fieldref>
         </list>
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="status" enum="GrabStatus" />
             <pad bytes="23" />
         </reply>
@@ -930,7 +1019,7 @@ authorization from the authors.
         <field type="CARD8"  name="device_id" />
         <pad bytes="1" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="status" altenum="GrabStatus" />
             <pad bytes="23" />
             <field type="DeviceState" name="control" />
@@ -1005,7 +1094,7 @@ authorization from the authors.
         <pad bytes="1" />
         <field type="DeviceCtl" name="control" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8" name="xi_reply_type" />
             <field type="CARD8" name="status" altenum="GrabStatus" />
             <pad bytes="23" />
         </reply>
@@ -1019,7 +1108,7 @@ authorization from the authors.
         <field type="CARD8"  name="device_id" />
         <pad bytes="3" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8"  name="xi_reply_type" />
             <field type="CARD16" name="num_atoms" />
             <pad bytes="22" />
             <list type="ATOM" name="atoms">
@@ -1046,30 +1135,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>
 
@@ -1092,7 +1177,7 @@ authorization from the authors.
         <field type="BOOL"   name="delete" />
         <pad bytes="2" />
         <reply>
-            <pad bytes="1" />
+            <field type="CARD8"  name="xi_reply_type" />
             <field type="ATOM"   name="type" />
             <field type="CARD32" name="bytes_after" />
             <field type="CARD32" name="num_items" />
@@ -1426,7 +1511,7 @@ authorization from the authors.
         <field type="CARD16"   name="number" />
         <field type="CARD16"   name="scroll_type" enum="ScrollType" />
         <pad bytes="2" />
-        <field type="CARD32"   name="flags" enum="ScrollFlags" />
+        <field type="CARD32"   name="flags" mask="ScrollFlags" />
         <field type="FP3232"   name="increment" />
     </struct>
 
@@ -1470,26 +1555,16 @@ authorization from the authors.
 
     <struct name="XIDeviceInfo">
         <field type="DeviceId" name="deviceid" altenum="Device" />
-        <field type="CARD16"   name="type" altenum="DeviceType" />
+        <field type="CARD16"   name="type" enum="DeviceType" />
         <field type="DeviceId" name="attachment" altenum="Device" />
         <field type="CARD16"   name="num_classes" />
         <field type="CARD16"   name="name_len" />
         <field type="BOOL"     name="enabled" />
         <pad bytes="1" />
         <list type="char" name="name">
-            <!-- name_len is without padding, so we've to pad on our own,
-                 auto align pad after the list would be helpfull -->
-            <op op="*">
-                <op op="/">
-                    <op op="+">
-                        <fieldref>name_len</fieldref>
-                        <value>3</value>
-                    </op>
-                    <value>4</value>
-                </op>
-                <value>4</value>
-            </op>
+            <fieldref>name_len</fieldref>
         </list>
+        <pad align="4" />
         <list type="DeviceClass" name="classes">
             <fieldref>num_classes</fieldref>
         </list>
@@ -1613,6 +1688,7 @@ authorization from the authors.
     </struct>
 
     <request name="XIPassiveGrabDevice" opcode="54">
+        <!-- field "time" is unused and its value is undefined -->
         <field type="TIMESTAMP" name="time" altenum="Time" />
         <field type="WINDOW"    name="grab_window" />
         <field type="CURSOR"    name="cursor" />
@@ -1808,6 +1884,12 @@ authorization from the authors.
         </list>
     </event>
 
+    <!-- the highest bit in a CARD8 device_id-field indicates that more
+       events will follow -->
+    <enum name="MoreEventsMask">
+       <item name="MoreEvents"> <bit>7</bit> </item> <!-- 0x80 -->
+    </enum>
+
     <event name="DeviceKeyPress" number="1">
         <field type="BYTE"      name="detail" />
         <field type="TIMESTAMP" name="time" />
@@ -1818,9 +1900,9 @@ authorization from the authors.
         <field type="INT16"     name="root_y" />
         <field type="INT16"     name="event_x" />
         <field type="INT16"     name="event_y" />
-        <field type="CARD16"    name="state" />
+        <field type="CARD16"    name="state" mask="KeyButMask" />
         <field type="BOOL"      name="same_screen" />
-        <field type="CARD8"     name="device_id" />
+        <field type="CARD8"     name="device_id" altmask="MoreEventsMask" />
     </event>
 
     <eventcopy name="DeviceKeyRelease"    number="2" ref="DeviceKeyPress" />
@@ -1841,13 +1923,25 @@ authorization from the authors.
     <eventcopy name="ProximityIn"    number="8" ref="DeviceKeyPress" />
     <eventcopy name="ProximityOut"   number="9" ref="DeviceKeyPress" />
 
+    <enum name="ClassesReportedMask">
+        <item name="OutOfProximity">     <bit>7</bit> </item> <!-- 0x80 -->
+            <!-- 0 = InProxmity, 1 = OutOfProximity -->
+
+        <item name="DeviceModeAbsolute"> <bit>6</bit> </item> <!-- 0x40 -->
+            <!-- 0 = Relative, 1 = Absolute -->
+
+        <item name="ReportingValuators"> <bit>2</bit> </item> <!-- 0x04 -->
+        <item name="ReportingButtons">   <bit>1</bit> </item> <!-- 0x02 -->
+        <item name="ReportingKeys">      <bit>0</bit> </item> <!-- 0x01 -->
+    </enum>
+
     <event name="DeviceStateNotify" number="10">
-        <field type="BYTE"      name="device_id" />
+        <field type="BYTE"      name="device_id" altmask="MoreEventsMask" />
         <field type="TIMESTAMP" name="time" />
         <field type="CARD8"     name="num_keys" />
         <field type="CARD8"     name="num_buttons" />
         <field type="CARD8"     name="num_valuators" />
-        <field type="CARD8"     name="classes_reported" />
+        <field type="CARD8"     name="classes_reported" mask="ClassesReportedMask" />
         <list type="CARD8"      name="buttons">
             <value>4</value>
         </list>
@@ -1861,7 +1955,7 @@ authorization from the authors.
 
     <event name="DeviceMappingNotify" number="11">
         <field type="BYTE"    name="device_id" />
-        <field type="CARD8"   name="request" />
+        <field type="CARD8"   name="request" enum="Mapping" />
         <field type="KeyCode" name="first_keycode" />
         <field type="CARD8"   name="count" />
         <pad bytes="1" />
@@ -1869,22 +1963,27 @@ authorization from the authors.
         <pad bytes="20" />
     </event>
 
+    <enum name="ChangeDevice">
+       <item name="NewPointer">  <value>0</value> </item>
+       <item name="NewKeyboard"> <value>1</value> </item>
+    </enum>
+
     <event name="ChangeDeviceNotify" number="12">
         <field type="BYTE"      name="device_id" />
         <field type="TIMESTAMP" name="time" />
-        <field type="CARD8"     name="request" />
+        <field type="CARD8"     name="request" enum="ChangeDevice" />
         <pad bytes="23" />
     </event>
 
     <event name="DeviceKeyStateNotify" number="13">
-        <field type="BYTE" name="device_id" />
+        <field type="BYTE" name="device_id" altmask="MoreEventsMask" />
         <list type="CARD8" name="keys">
             <value>28</value>
         </list>
     </event>
 
     <event name="DeviceButtonStateNotify" number="14">
-        <field type="BYTE" name="device_id" />
+        <field type="BYTE" name="device_id" altmask="MoreEventsMask" />
         <list type="CARD8" name="buttons">
             <value>28</value>
         </list>
@@ -2244,6 +2343,11 @@ authorization from the authors.
 
     <!-- ⋅⋅⋅ Events (v2.3) ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ -->
 
+    <enum name="BarrierFlags">
+       <item name="PointerReleased"> <bit>0</bit> </item>
+       <item name="DeviceIsGrabbed"> <bit>1</bit> </item>
+    </enum>
+
     <event name="BarrierHit" number="25" xge="true">
         <field type="DeviceId"  name="deviceid" altenum="Device" />
         <field type="TIMESTAMP" name="time" altenum="Time" />
@@ -2254,7 +2358,7 @@ authorization from the authors.
         <field type="BARRIER"   name="barrier" />
         <!-- 32 byte boundary -->
         <field type="CARD32"    name="dtime" />
-        <field type="CARD32"    name="flags" />
+        <field type="CARD32"    name="flags" mask="BarrierFlags" />
         <field type="DeviceId"  name="sourceid" altenum="Device" />
         <pad bytes="2" />
         <field type="FP1616"    name="root_x" />