summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-02-15 18:49:58 +0000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-09-30 09:24:18 +1000
commit3304bbff9b4ed63f1a47410a5320a136420ba2c6 (patch)
tree8f0c9e5d1cd32476287cb426bc82fa7eda5e48a6 /include
parent635a1f50bc65512ec491fe71b9dfa8cf9118e2c2 (diff)
Input: Add smooth-scrolling support to GetPointerEvents
For scroll wheel support, we used to send buttons 4/5 and 6/7 for horizontal/vertical positive/negative scroll events. For touchpads, we really want more fine-grained scroll values. GetPointerEvents now accepts both old-school scroll button presses, and new-style scroll axis events, while emitting both types of events to support both old and new clients. This works with the new XIScrollClass to mark axes as scrolling axes. Drivers mark any valuators that send scroll events with SetScrollValuator. (Currently missing: the XIDeviceChangeEvent being sent when a driver changes a scroll axis at run-time. This can be added later.) Note: the SCROLL_TYPE enums are intentionally different values to the XI2 proto values to avoid copy/overlapping range bugs. Co-authored-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'include')
-rw-r--r--include/exevents.h23
-rw-r--r--include/inputstr.h20
2 files changed, 43 insertions, 0 deletions
diff --git a/include/exevents.h b/include/exevents.h
index 731f31eac..4fe6c61a9 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -37,6 +37,22 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* Interface available to drivers *
***************************************************************/
+/**
+ * Scroll flags for ::SetScrollValuator.
+ */
+enum ScrollFlags {
+ SCROLL_FLAG_NONE = 0,
+ /**
+ * Do not emulate legacy button events for valuator events on this axis.
+ */
+ SCROLL_FLAG_DONT_EMULATE = (1 << 1),
+ /**
+ * This axis is the preferred axis for valuator emulation for this axis'
+ * scroll type.
+ */
+ SCROLL_FLAG_PREFERRED = (1 << 2)
+};
+
extern _X_EXPORT int InitProximityClassDeviceStruct(
DeviceIntPtr /* dev */);
@@ -51,6 +67,13 @@ extern _X_EXPORT Bool InitValuatorAxisStruct(
int /* max_res */,
int /* mode */);
+extern _X_EXPORT Bool SetScrollValuator(
+ DeviceIntPtr /* dev */,
+ int /* axnum */,
+ enum ScrollType /* type */,
+ double /* increment */,
+ int /* flags */);
+
/* Input device properties */
extern _X_EXPORT void XIDeleteAllDeviceProperties(
DeviceIntPtr /* device */
diff --git a/include/inputstr.h b/include/inputstr.h
index c25f5c670..9d4108ef5 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -75,6 +75,16 @@ extern _X_EXPORT int CountBits(const uint8_t *mask, int len);
#define XI2MASKSIZE ((XI2LASTEVENT + 7)/8) /* no of bits for masks */
/**
+ * Scroll types for ::SetScrollValuator and the scroll type in the
+ * ::ScrollInfoPtr.
+ */
+enum ScrollType {
+ SCROLL_TYPE_NONE = 0, /**< Not a scrolling valuator */
+ SCROLL_TYPE_VERTICAL = 8,
+ SCROLL_TYPE_HORIZONTAL = 9,
+};
+
+/**
* This struct stores the core event mask for each client except the client
* that created the window.
*
@@ -252,6 +262,12 @@ typedef struct _KeyClassRec {
struct _XkbSrvInfo *xkbInfo;
} KeyClassRec, *KeyClassPtr;
+typedef struct _ScrollInfo {
+ enum ScrollType type;
+ double increment;
+ int flags;
+} ScrollInfo, *ScrollInfoPtr;
+
typedef struct _AxisInfo {
int resolution;
int min_resolution;
@@ -260,6 +276,7 @@ typedef struct _AxisInfo {
int max_value;
Atom label;
CARD8 mode;
+ ScrollInfo scroll;
} AxisInfo, *AxisInfoPtr;
typedef struct _ValuatorAccelerationRec {
@@ -283,6 +300,8 @@ typedef struct _ValuatorClassRec {
unsigned short numAxes;
double *axisVal; /* always absolute, but device-coord system */
ValuatorAccelerationRec accelScheme;
+ int h_scroll_axis; /* horiz smooth-scrolling axis */
+ int v_scroll_axis; /* vert smooth-scrolling axis */
} ValuatorClassRec;
typedef struct _ButtonClassRec {
@@ -524,6 +543,7 @@ typedef struct _DeviceIntRec {
double valuators[MAX_VALUATORS];
int numValuators;
DeviceIntPtr slave;
+ ValuatorMask *scroll;
} last;
/* Input device property handling. */