[Xcb] [PATCH proto 04/10] xinput: struct DeviceCtl: full support

Christian Linhart chris at demorecorder.com
Thu Sep 4 01:53:15 PDT 2014


replace uninterpreted_data by switch-case

this is needed by request ChangeDeviceControl.

spec:
http://cgit.freedesktop.org/xorg/proto/inputproto/tree/specs/XIproto.txt?id=inputproto-2.3.1#n688
http://cgit.freedesktop.org/xorg/lib/libXi/tree/specs/encoding.xml?id=libXi-1.7.4#n1907

Note: Only the DeviceCtl of type DeviceResolution is defined in both specs.
( this is struct name="DeviceResolutionCtl" in the xml. )
The other DeviceCtls are not defined in any of the specs.

code:
http://cgit.freedesktop.org/xorg/proto/inputproto/tree/XI.h?id=inputproto-2.3.1#n170
http://cgit.freedesktop.org/xorg/proto/inputproto/tree/XIproto.h?id=inputproto-2.3.1#n1343
---
 src/xinput.xml | 49 ++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 42 insertions(+), 7 deletions(-)

diff --git a/src/xinput.xml b/src/xinput.xml
index 5da79b1..a0839af 100644
--- a/src/xinput.xml
+++ b/src/xinput.xml
@@ -43,15 +43,14 @@
 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:
 * QueryDeviceState reply field "classes" ( structs InputState, ... )
-* 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
@@ -1205,20 +1204,56 @@ <struct name="DeviceEnableCtrl">
         <field type="CARD8"  name="enable" />
         <pad bytes="3" />
     </struct>
 
     <struct name="DeviceCtl">
         <field type="CARD16" name="control_id" enum="DeviceControl" />
         <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>control_id</fieldref>
+            <case name="resolution">
+                <enumref ref="DeviceControl">resolution</enumref>
+                <field type="CARD8"  name="first_valuator" />
+                <field type="CARD8"  name="num_valuators" />
+                <pad bytes="2" />
+                <list type="CARD32"  name="resolution_values">
+                    <fieldref>num_valuators</fieldref>
+                </list>
+            </case>
+            <case name="abs_calib">
+                <enumref ref="DeviceControl">abs_calib</enumref>
+                <field type="INT32"  name="min_x" />
+                <field type="INT32"  name="max_x" />
+                <field type="INT32"  name="min_y" />
+                <field type="INT32"  name="max_y" />
+                <field type="CARD32" name="flip_x" />
+                <field type="CARD32" name="flip_y" />
+                <field type="CARD32" name="rotation" />
+                <field type="CARD32" name="button_threshold" />
+            </case>
+            <case name="core">
+                <enumref ref="DeviceControl">core</enumref>
+                <field type="CARD8"  name="status" />
+                <pad bytes="3" />
+            </case>
+            <case name="enable">
+                <enumref ref="DeviceControl">enable</enumref>
+                <field type="CARD8"  name="enable" />
+                <pad bytes="3" />
+            </case>
+            <case name="abs_area">
+                <enumref ref="DeviceControl">abs_area</enumref>
+                <field type="CARD32" name="offset_x" />
+                <field type="CARD32" name="offset_y" />
+                <field type="INT32"  name="width" />
+                <field type="INT32"  name="height" />
+                <field type="INT32"  name="screen" />
+                <field type="CARD32" name="following" />
+            </case>
+        </switch>
     </struct>
 
     <request name="ChangeDeviceControl" opcode="35">
         <field type="CARD16" name="control_id" enum="DeviceControl" />
         <field type="CARD8"  name="device_id" />
         <pad bytes="1" />
         <field type="DeviceCtl" name="control" />
-- 
2.0.1



More information about the Xcb mailing list