summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-07-13 11:47:30 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-07-15 10:47:29 +1000
commit8e7f99c27ab39df0ef6a79443266b00ad43d824f (patch)
tree0d2c0eb33ee5cecd9b1cb31069e208a48788f84e /src
parentef3c7437ef8262741486889f014d13607f43db71 (diff)
touchpad: don't init a horizontal scroll area on touchpads <50mm high
We simply don't have enough space on those touchpads to have an area carved out for horizontal scrolling. Given that horizontal scrolling is rarely needed anyway users of these touchpads will just have to cling to scroll bars or use two-finger scrolling. Exception are small clickpads because they already have an area blocked off for software buttons and those small clickpads generally come from a time when clickfinger wasn't much of a thing yet. https://bugs.freedesktop.org/show_bug.cgi?id=96910 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/evdev-mt-touchpad-edge-scroll.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c
index 8222bba4..610744a1 100644
--- a/src/evdev-mt-touchpad-edge-scroll.c
+++ b/src/evdev-mt-touchpad-edge-scroll.c
@@ -286,13 +286,29 @@ tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device)
{
struct tp_touch *t;
int edge_width, edge_height;
+ double width, height;
+ bool want_horiz_scroll = true;
+
+ /* Touchpads smaller than 50mm are not tall enough to have a
+ horizontal scroll area, it takes too much space away. But
+ clickpads have enough space here anyway because of the
+ software button area (and all these tiny clickpads were built
+ when software buttons were a thing, e.g. Lenovo *20 series)
+ */
+ if (!tp->buttons.is_clickpad) {
+ evdev_device_get_size(device, &width, &height);
+ want_horiz_scroll = (height >= 50);
+ }
/* 7mm edge size */
edge_width = device->abs.absinfo_x->resolution * 7;
edge_height = device->abs.absinfo_y->resolution * 7;
tp->scroll.right_edge = device->abs.absinfo_x->maximum - edge_width;
- tp->scroll.bottom_edge = device->abs.absinfo_y->maximum - edge_height;
+ if (want_horiz_scroll)
+ tp->scroll.bottom_edge = device->abs.absinfo_y->maximum - edge_height;
+ else
+ tp->scroll.bottom_edge = INT_MAX;
tp_for_each_touch(tp, t) {
t->scroll.direction = -1;