diff options
author | Jason Gerecke <jason.gerecke@wacom.com> | 2022-04-07 09:56:00 -0700 |
---|---|---|
committer | Ping Cheng <pinglinux@gmail.com> | 2022-04-14 15:36:00 -0700 |
commit | 742c3e4494bf89301031ba6a627a7f5d5f49556f (patch) | |
tree | 5703c770d74a9453166e47bde5856d792d27ed11 | |
parent | 1ca6fca7932d540ea7765bb9f66be050f61592aa (diff) | |
download | xf86-input-wacom-742c3e4494bf89301031ba6a627a7f5d5f49556f.tar.gz |
Allow negative panscroll threshold for inverted scrolling
The driver's "pan" feature allows you to send scroll events by holding down
a defined stylus button and dragging the pen. Dragging the pen from top
to bottom will cause the driver to send scroll-up events, and vice-versa.
This simulates physically dragging the page under the cursor and works
particularly well with display tablets.
The rate at which scroll events are sent is controlled by comparing the
distance the pen has moved "down" to a defined threshold value. If the
distance exceeds the threshold a scroll-up event is sent; if it exceeds
the the threshold * -1 a scroll-down event is sent.
This commit allows the driver to accept negative threshold values to
produce an inverted scrolling behavior (i.e. dragging the pen from top
to bottom causes scroll-down events instead of scroll-up). To do this
we just relax the checks performed at device configuration and property
setting (affecting the "PanScrollThreshold" driver option and "Wacom
Panscroll Threshold" Xinput property, respectively).
Link: https://github.com/linuxwacom/xf86-input-wacom/issues/257
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
-rw-r--r-- | src/wcmCommon.c | 4 | ||||
-rw-r--r-- | src/x11/xf86WacomProperties.c | 13 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c index 1d53a15..c2ebc9a 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -1564,10 +1564,10 @@ int wcmInitTablet(WacomDevicePtr priv) /* Calculate default panscroll threshold if not set */ wcmLog(priv, W_CONFIG, "panscroll is %d\n", common->wcmPanscrollThreshold); - if (common->wcmPanscrollThreshold < 1) { + if (common->wcmPanscrollThreshold == 0) { common->wcmPanscrollThreshold = common->wcmResolY * 13 / 1000; /* 13mm */ } - if (common->wcmPanscrollThreshold < 1) { + if (common->wcmPanscrollThreshold == 0) { common->wcmPanscrollThreshold = 1000; } wcmLog(priv, W_CONFIG, "panscroll modified to %d\n", common->wcmPanscrollThreshold); diff --git a/src/x11/xf86WacomProperties.c b/src/x11/xf86WacomProperties.c index bc6e1be..a27ce1f 100644 --- a/src/x11/xf86WacomProperties.c +++ b/src/x11/xf86WacomProperties.c @@ -931,17 +931,22 @@ static int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr pr common->wcmPressureRecalibration = values[0]; } else if (property == prop_panscroll_threshold) { - CARD32 *values = (CARD32*)prop->data; + INT32 *values = (INT32*)prop->data; if (prop->size != 1 || prop->format != 32) return BadValue; - if (values[0] <= 0) - return BadValue; - if (IsTouch(priv)) return BadMatch; + /* Reset to default if set to 0 */ + if (values[0] == 0) { + values[0] = common->wcmResolY * 13 / 1000; /* 13mm */ + } + if (values[0] == 0) { + values[0] = 1000; + } + if (!checkonly) common->wcmPanscrollThreshold = values[0]; } else |