xinput: struct DeviceState: full support
authorChristian Linhart <chris@demorecorder.com>
Thu, 4 Sep 2014 08:53:14 +0000 (10:53 +0200)
committerChristian Linhart <chris@demorecorder.com>
Mon, 3 Nov 2014 10:23:22 +0000 (11:23 +0100)
replace uninterpreted_data by switch-case

this is needed by reply GetDeviceControl.

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

Note: Only the DeviceControl of type DeviceResolution is defined in both specs.
( this is struct name="DeviceResolutionState" in the xml. )
The other DeviceControls 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#n1263

Message-ID: <1409820801-43629-3-git-send-email-chris@demorecorder.com>
Patch-Thread-Subject: [Xcb] xinput: xml-fixes possible with new generator features
Patch-Set: XmlFixesNewGenerator
Patch-Number: proto 03/10
Patch-Version: V1
Signed-off-by: Christian Linhart <chris@DemoRecorder.com>
src/xinput.xml

index c99d20c..109bcba 100644 (file)
@@ -47,7 +47,6 @@ which will, e.g., be necessary for server-side xcb.
 
 This affects the following:
 * 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, ... )
@@ -1128,12 +1127,53 @@ in struct DeviceTimeCoord.
     <struct name="DeviceState">
         <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="CARD32" name="num_valuators" />
+                <list type="CARD32"  name="resolution_values">
+                    <fieldref>num_valuators</fieldref>
+                </list>
+                <list type="CARD32" name="resolution_min">
+                    <fieldref>num_valuators</fieldref>
+                </list>
+                <list type="CARD32" name="resolution_max">
+                    <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" />
+                <field type="CARD8"  name="iscore" />
+                <pad bytes="2" />
+            </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="CARD32" name="width" />
+                <field type="CARD32" name="height" />
+                <field type="CARD32" name="screen" />
+                <field type="CARD32" name="following" />
+            </case>
+        </switch>
     </struct>
 
     <request name="GetDeviceControl" opcode="34">