@@ -141,11 +141,18 @@
#define XIKeyClass 0
#define XIButtonClass 1
#define XIValuatorClass 2
+#define XIScrollClass 3
/* Axis flags */
-#define XIAxisVertScroll (1 << 0)
-#define XIAxisHorizScroll (1 << 1)
-#define XIAxisWrapAround (1 << 2)
+#define XIAxisFlagWrapAround (1 << 0)
+
+/* Scroll class types */
+#define XIScrollTypeVertical 1
+#define XIScrollTypeHorizontal 2
+
+/* Scroll class flags */
+#define XIScrollFlagEmulate (1 << 0)
+#define XIScrollFlagPreferred (1 << 1)
/* Device event flags (common) */
/* Device event flags (key events only) */
@@ -191,6 +191,22 @@ typedef struct {
*/
} xXIValuatorInfo;
+/***
+ * Denotes a scroll valuator on a device.
+ * One XIScrollInfo describes exactly one scroll valuator that must have a
+ * XIValuatorInfo struct.
+ */
+typedef struct {
+ uint16_t type; /**< Always ValuatorClass */
+ uint16_t length; /**< Length in 4 byte units */
+ uint16_t sourceid; /**< source device for this class */
+ uint16_t number; /**< Valuator number */
+ uint16_t scroll_type; /**< ::XIScrollTypeVertical, ::XIScrollTypeHorizontal */
+ uint16_t pad0;
+ uint32_t flags; /**< ::XIScrollFlagEmulate, ::XIScrollFlagPreferred */
+ FP3232 increment; /**< Increment for one unit of scrolling */
+} xXIScrollInfo;
+
/**
* Used to select for events on a given window.
* Struct is followed by (mask_len * CARD8), with each bit set representing
@@ -126,20 +126,19 @@ are able to provide scrolling events through multi-finger drag gestures, or
simply dragging your finger along a designated strip along the side of the
touchpad.
-Newer X servers may provide scrolling information through specific
-valuators to provide scroll events with more precision than the button
-events. Valuators for axes sending scrolling information should have the
-VertScroll or HorizScroll axis flag set.
+Newer X servers may provide scrolling information through valuators to
+provide scroll events with more precision than the button events. Valuators
+for axes sending scrolling information must have one ScrollClass for each
+scrolling axis.
If scrolling valuators are present on a device, the server must provide
two-way emulation between these valuators and the legacy button events for
-each delta unit of scrolling. The delta value of one unit is
-device-dependent.
+each delta unit of scrolling.
One unit of scrolling in either direction is considered to be equivalent to
-one button event for the legacy events, e.g. for an unit size of 1.0, -2.0 on an axis marked with
-VertScroll sends two button press/release events for button 4. Likewise, a
-button press event for button 7 generates an event on the HorizScroll
+one button event, e.g. for a unit size of 1.0, -2.0 on an valuator type
+Vertical sends two button press/release events for button 4. Likewise, a
+button press event for button 7 generates an event on the Horizontal
valuator with a value of +1.0. The server may accumulate deltas of less than
one unit of scrolling.
@@ -151,9 +150,11 @@ If an axis is flagged as WrapAround, the server attempts wrap-around
detection and generates the scroll events taking a potential wrap-around
into account.
-The behavior of scroll button emulation if there is more than one VertScroll
-or more than one HorizScroll axes on the same device is implementation-
-dependent.
+If more than one scroll valuator of the same type is present on a device,
+the valuator marked with Preferred is used to convert legacy button events
+into scroll valuator events. If no valuator is marked Preferred or more than
+one valuator is marked with Preferred, this should be considered a driver
+bug and the behaviour is implementation-dependent.
4. The Master/Slave device hierarchy
------------------------------------
@@ -343,7 +344,7 @@ If major_version is less than 2, a BadValue error occurs.
name: LISTofCHAR8
classes: LISTofCLASS }
- CLASS { BUTTONCLASS, KEYCLASS, AXISCLASS }
+ CLASS { BUTTONCLASS, KEYCLASS, AXISCLASS, SCROLLCLASS }
BUTTONCLASS { type: ButtonClass
length: CARD16
@@ -370,9 +371,21 @@ If major_version is less than 2, a BadValue error occurs.
mode: CARD8
flags*: SETofAXISFLAGS }
+ SCROLLCLASS* {type: ScrollClass
+ length: CARD16
+ sourceid: CARD16
+ axisnumber: CARD16
+ scroll_type: SCROLLTYPE
+ flags: SETofSCROLLFLAGS
+ increment: FP3232 }
+
* since XI 2.1
- AXISFLAGS { VertScroll, HorizScroll, WrapAround }
+ AXISFLAGS { WrapAround }
+
+ SCROLLTYPE { Vertical, Horizontal }
+
+ SCROLLFLAGS { Emulate, Preferred }
XIQueryDevice details information about the requested input devices.
@@ -474,14 +487,38 @@ The following classes may occur only once: ButtonClass, KeyClass
Last published axis value (if mode is absolute).
flags
A set of flags describing additional axis information
- VertScroll: This axis is a vertical scrolling axis
- HorizScroll: This axis is a horizontal scrolling axis
WrapAround: This axis is a ring and wraps from max to min or
min to max.
An axis in Relative mode may specify min and max as a hint to the
client. If no min and max information is available, both must be 0.
+ ScrollClass:
+ type
+ Always ScrollClass.
+ length
+ Length in 4 byte units.
+ sourceid
+ The device this class originates from.
+ axisnumber
+ Axis number that is referred to. This axis number must be listed in
+ the ValuatorClassInfo.
+ scroll_type:
+ Vertical for a vertical scrolling axis, Horizontal for a horizontal
+ scrolling axis
+ flags:
+ A set of flags that apply to this scroll axis.
+ Emulate: legacy scroll button events are generated for each unit of
+ scrolling on this axis (see Section 3.4)
+ Preferred: This axis is the preferred axis for emulating valuator
+ events from legacy scroll button events.
+ increment:
+ The valuator delta equivalent to one positive unit of scrolling.
+
+A ScrollClass may only exist if the device has at least one ValuatorClass
+and each axisnumber listed in any ScrollClass. Only one ScrollClass may
+exist per ValuatorClass.
+
????
XISelectEvents
window: Window