From ee3d22bb5d53e8ce7a838f8778bc68f5fbe0d23b Mon Sep 17 00:00:00 2001 From: Peter De Wachter Date: Wed, 3 Oct 2012 20:48:24 +0200 Subject: [PATCH 1/2] 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 float, default value is 1. Signed-off-by: Peter De Wachter --- src/evdev.c | 21 ++++++++++++++++++--- src/evdev.h | 5 +++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 2aab97f..bc523e2 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1601,11 +1601,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 } @@ -2294,6 +2300,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 = + xf86SetRealOption(pInfo->options, "VertScrollDelta", 1.0); + pEvdev->smoothScroll.horiz_delta = + xf86SetRealOption(pInfo->options, "HorizScrollDelta", 1.0); + pEvdev->smoothScroll.dial_delta = + xf86SetRealOption(pInfo->options, "DialDelta", 1.0); +#endif } if (rc) diff --git a/src/evdev.h b/src/evdev.h index 2901886..ad1d94f 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -222,6 +222,11 @@ typedef struct { Time expires; /* time of expiry */ Time timeout; } emulateWheel; + struct { + float vert_delta; + float horiz_delta; + float dial_delta; + } smoothScroll; /* run-time calibration */ struct { int min_x; -- 1.7.10.4