summaryrefslogtreecommitdiff
path: root/dix/devices.c
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 /dix/devices.c
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 'dix/devices.c')
-rw-r--r--dix/devices.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/dix/devices.c b/dix/devices.c
index ab8a648a9..64557aaf1 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -260,6 +260,8 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
offsetof(DeviceIntRec, devPrivates), PRIVATE_DEVICE);
if (!dev)
return (DeviceIntPtr)NULL;
+
+ dev->last.scroll = NULL;
dev->id = devid;
dev->public.processInputProc = ProcessOtherEvent;
dev->public.realInputProc = ProcessOtherEvent;
@@ -939,6 +941,7 @@ CloseDevice(DeviceIntPtr dev)
free(dev->deviceGrab.sync.event);
free(dev->config_info); /* Allocated in xf86ActivateDevice. */
+ free(dev->last.scroll);
dev->config_info = NULL;
dixFreeObjectWithPrivates(dev, PRIVATE_DEVICE);
}
@@ -1277,10 +1280,19 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
if (!valc)
return FALSE;
+ dev->last.scroll = valuator_mask_new(numAxes);
+ if (!dev->last.scroll)
+ {
+ free(valc);
+ return FALSE;
+ }
+
valc->sourceid = dev->id;
valc->motion = NULL;
valc->first_motion = 0;
valc->last_motion = 0;
+ valc->h_scroll_axis = -1;
+ valc->v_scroll_axis = -1;
valc->numMotionEvents = numMotionEvents;
valc->motionHintWindow = NullWindow;