summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-11-09 16:01:48 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-11-09 16:01:48 +1000
commit745fca03a20117583bc18c7134583311ff52c29c (patch)
treec631b3841b763b82e9dc1202d70ab5e726e9c382 /src
parenteede8ccffc1a831f4de89403edc8dffd52494e8b (diff)
parentb450efdf95999cad08de23ce069f04a66bdae24b (diff)
Merge branch 'smooth-scrolling'
Conflicts: src/evdev.c Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/evdev.c17
-rw-r--r--src/evdev.h4
2 files changed, 20 insertions, 1 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 028a9e1..a7a0f3f 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -277,10 +277,12 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
}
}
+#ifndef HAVE_SMOOTH_SCROLLING
static int wheel_up_button = 4;
static int wheel_down_button = 5;
static int wheel_left_button = 6;
static int wheel_right_button = 7;
+#endif
static EventQueuePtr
EvdevNextInQueue(InputInfoPtr pInfo)
@@ -600,6 +602,7 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
value = ev->value;
switch (ev->code) {
+#ifndef HAVE_SMOOTH_SCROLLING
case REL_WHEEL:
if (value > 0)
EvdevQueueButtonClicks(pInfo, wheel_up_button, value);
@@ -614,8 +617,8 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
else if (value < 0)
EvdevQueueButtonClicks(pInfo, wheel_left_button, -value);
break;
-
/* We don't post wheel events as axis motion. */
+#endif
default:
/* Ignore EV_REL events if we never set up for them. */
if (!(pEvdev->flags & EVDEV_RELATIVE_EVENTS))
@@ -1108,6 +1111,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
if (num_axes < 1)
goto out;
+#ifndef HAVE_SMOOTH_SCROLLING
/* Wheels are special, we post them as button events. So let's ignore them
* in the axes list too */
if (EvdevBitIsSet(pEvdev->rel_bitmask, REL_WHEEL))
@@ -1119,6 +1123,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
if (num_axes <= 0)
goto out;
+#endif
if (num_axes > MAX_VALUATORS) {
xf86IDrvMsg(pInfo, X_WARNING, "found %d axes, limiting to %d.\n", num_axes, MAX_VALUATORS);
@@ -1136,10 +1141,12 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
for (axis = REL_X; i < MAX_VALUATORS && axis <= REL_MAX; axis++)
{
pEvdev->axis_map[axis] = -1;
+#ifndef HAVE_SMOOTH_SCROLLING
/* We don't post wheel events, so ignore them here too */
if (axis == REL_WHEEL || axis == REL_HWHEEL || axis == REL_DIAL)
continue;
if (!EvdevBitIsSet(pEvdev->rel_bitmask, axis))
+#endif
continue;
pEvdev->axis_map[axis] = i;
i++;
@@ -1168,6 +1175,14 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
xf86InitValuatorAxisStruct(device, axnum, atoms[axnum], -1, -1, 1, 0, 1,
Relative);
xf86InitValuatorDefaults(device, axnum);
+#ifdef HAVE_SMOOTH_SCROLLING
+ if (axis == REL_WHEEL)
+ SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED);
+ else if (axis == REL_DIAL)
+ SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_NONE);
+ else if (axis == REL_HWHEEL)
+ SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL, -1.0, SCROLL_FLAG_NONE);
+#endif
}
free(atoms);
diff --git a/src/evdev.h b/src/evdev.h
index a18a025..b2e2f42 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -55,6 +55,10 @@
#define LED_CNT (LED_MAX+1)
#endif
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
+#define HAVE_SMOOTH_SCROLLING 1
+#endif
+
#define EVDEV_MAXBUTTONS 32
#define EVDEV_MAXQUEUE 32