[Xcb] [PATCH proto 06/10 V2] xinput: struct DeviceClass: full support

Christian Linhart chris at DemoRecorder.com
Mon Oct 13 04:11:45 PDT 2014


replace uninterpreted_data by switch-case

this is needed by struct XIDeviceInfo which is needed by reply XIQueryDevice.

changes for V2 of this patch:
* remove the pad after "sourceid" because that space is used by the first two bytes defined inside each case of the bit-case.
  ( noticed that problem by testing )

spec:
http://cgit.freedesktop.org/xorg/proto/inputproto/tree/specs/XI2proto.txt?id=inputproto-2.3.1#n752

Note:
The spec lists TOUCHCLASS.num_touches as a CARD16 but the XI2proto.h header and the xml
use the type CARD8 for it.
Is this a spec bug?

code:
http://cgit.freedesktop.org/xorg/proto/inputproto/tree/XI2.h?id=inputproto-2.3.1#n138
http://cgit.freedesktop.org/xorg/proto/inputproto/tree/XI2proto.h?id=inputproto-2.3.1#n117
---
 src/xinput.xml | 61 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 50 insertions(+), 10 deletions(-)

diff --git a/src/xinput.xml b/src/xinput.xml
index e5d0d39..e9ff19e 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, ... )
-* 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 )
@@ -1723,24 +1722,64 @@ <struct name="ValuatorClass">
     </struct>
 
     <struct name="DeviceClass">
         <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">
         <field type="DeviceId" name="deviceid" altenum="Device" />
         <field type="CARD16"   name="type" enum="DeviceType" />
         <field type="DeviceId" name="attachment" altenum="Device" />
         <field type="CARD16"   name="num_classes" />
-- 2.0.1 _______________________________________________ Xcb mailing list Xcb at lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/xcb



More information about the Xcb mailing list