summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter De Wachter <pdewacht@gmail.com>2012-10-03 20:48:24 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2013-10-21 15:47:54 +1000
commitc3251deb4b988610c3766081345e49f538fca865 (patch)
treef4b5ae815d9d4df9c1eece7c5f6710cb45cfa0e6
parentcabed4bbb6757e55f067126965f26bb0f716fb55 (diff)
Add configuration options for smooth scrolling.
This patch creates three new xorg.conf options, VertScrollDelta, HorizScrollDelta and DialDelta, which adjust the sensitivity of smooth scrolling. These options take a positive integer, default value is 1. Signed-off-by: Peter De Wachter <pdewacht@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--man/evdev.man11
-rw-r--r--src/evdev.c30
-rw-r--r--src/evdev.h5
3 files changed, 40 insertions, 6 deletions
diff --git a/man/evdev.man b/man/evdev.man
index 220dd13..85cea10 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -226,6 +226,17 @@ Specify the X Input 1.x type (see XListInputDevices(__libmansuffix__)).
There is rarely a need to use this option, evdev will guess the device type
based on the device's capabilities. This option is provided for devices that
need quirks.
+.TP 7
+.BI "Option \*qVertScrollDelta\*q \*q" integer \*q
+The amount of motion considered one unit of scrolling vertically.
+Default: "1".
+.TP 7
+.BI "Option \*qHorizScrollDelta\*q \*q" integer \*q
+The amount of motion considered one unit of scrolling horizontally.
+Default: "1".
+.TP 7
+.BI "Option \*qDialDelta\*q \*q" integer \*q
+The amount of motion considered one unit of turning the dial. Default: "1".
.SH SUPPORTED PROPERTIES
The following properties are provided by the
diff --git a/src/evdev.c b/src/evdev.c
index 1aa92d2..812b177 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1533,7 +1533,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
NO_AXIS_LIMITS, NO_AXIS_LIMITS,
0, 0, 0, Relative);
SetScrollValuator(device, pEvdev->rel_axis_map[idx],
- SCROLL_TYPE_VERTICAL, -1.0,
+ SCROLL_TYPE_VERTICAL,
+ -pEvdev->smoothScroll.vert_delta,
SCROLL_FLAG_PREFERRED);
}
@@ -1546,7 +1547,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
NO_AXIS_LIMITS, NO_AXIS_LIMITS,
0, 0, 0, Relative);
SetScrollValuator(device, pEvdev->rel_axis_map[idx],
- SCROLL_TYPE_HORIZONTAL, 1.0,
+ SCROLL_TYPE_HORIZONTAL,
+ pEvdev->smoothScroll.horiz_delta,
SCROLL_FLAG_NONE);
}
@@ -1559,7 +1561,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
NO_AXIS_LIMITS, NO_AXIS_LIMITS,
0, 0, 0, Relative);
SetScrollValuator(device, pEvdev->rel_axis_map[idx],
- SCROLL_TYPE_VERTICAL, -1.0,
+ SCROLL_TYPE_VERTICAL,
+ -pEvdev->smoothScroll.dial_delta,
SCROLL_FLAG_NONE);
}
}
@@ -1702,11 +1705,17 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
xf86InitValuatorDefaults(device, axnum);
#ifdef HAVE_SMOOTH_SCROLLING
if (axis == REL_WHEEL)
- SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED);
+ SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
+ -pEvdev->smoothScroll.vert_delta,
+ SCROLL_FLAG_PREFERRED);
else if (axis == REL_DIAL)
- SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_NONE);
+ SetScrollValuator(device, axnum, SCROLL_TYPE_VERTICAL,
+ -pEvdev->smoothScroll.dial_delta,
+ SCROLL_FLAG_NONE);
else if (axis == REL_HWHEEL)
- SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE);
+ SetScrollValuator(device, axnum, SCROLL_TYPE_HORIZONTAL,
+ pEvdev->smoothScroll.horiz_delta,
+ SCROLL_FLAG_NONE);
#endif
}
@@ -2329,6 +2338,15 @@ EvdevProbe(InputInfoPtr pInfo)
xf86IDrvMsg(pInfo, X_INFO, "Adding scrollwheel support\n");
pEvdev->flags |= EVDEV_BUTTON_EVENTS;
pEvdev->flags |= EVDEV_RELATIVE_EVENTS;
+
+#ifdef HAVE_SMOOTH_SCROLLING
+ pEvdev->smoothScroll.vert_delta =
+ xf86SetIntOption(pInfo->options, "VertScrollDelta", 1);
+ pEvdev->smoothScroll.horiz_delta =
+ xf86SetIntOption(pInfo->options, "HorizScrollDelta", 1);
+ pEvdev->smoothScroll.dial_delta =
+ xf86SetIntOption(pInfo->options, "DialDelta", 1);
+#endif
}
out:
diff --git a/src/evdev.h b/src/evdev.h
index 563d108..520d017 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -221,6 +221,11 @@ typedef struct {
Time expires; /* time of expiry */
Time timeout;
} emulateWheel;
+ struct {
+ int vert_delta;
+ int horiz_delta;
+ int dial_delta;
+ } smoothScroll;
/* run-time calibration */
struct {
int min_x;