summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-06-30 10:11:17 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-07-14 07:46:54 +1000
commitcaf14fab16b2919b657087c80133cf357be84b09 (patch)
tree36f3adc3e2f80697d78427e96422343fd98785ca
parent3141b8437e3633f81d94cb9daf91b3af5977f9e9 (diff)
touchpad: reduce middle button size on Dell touchpads to 10mm
All Dell touchpas appear to have a visual marker on their touchpads. With a visible marker our middle button can (and should) be much smaller since we can rely on users to hit the button precisely. https://bugs.freedesktop.org/show_bug.cgi?id=96710 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Andy Lutomirski <luto@kernel.org> Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--src/evdev-mt-touchpad-buttons.c24
-rw-r--r--src/evdev.c1
-rw-r--r--src/evdev.h1
-rw-r--r--udev/90-libinput-model-quirks.hwdb7
4 files changed, 30 insertions, 3 deletions
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index a2f31217..cf49c830 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -544,13 +544,15 @@ tp_init_softbuttons(struct tp_dispatch *tp,
int width, height;
const struct input_absinfo *absinfo_x, *absinfo_y;
int xoffset, yoffset;
- int yres;
+ int xres, yres;
+ int mb_le, mb_re; /* middle button left/right edge */
absinfo_x = device->abs.absinfo_x;
absinfo_y = device->abs.absinfo_y;
xoffset = absinfo_x->minimum,
yoffset = absinfo_y->minimum,
+ xres = absinfo_x->resolution;
yres = absinfo_y->resolution;
width = device->abs.dimensions.x;
height = device->abs.dimensions.y;
@@ -575,9 +577,25 @@ tp_init_softbuttons(struct tp_dispatch *tp,
* touchpads don't have markings for the middle button at all so we
* need to make it big enough to reliably hit it but not too big so
* it takes away all the space.
+ *
+ * On touchpads with visible markings we reduce the size of the
+ * middle button since users have a visual guide.
+ *
+ * All Dell touchpads appear to have a middle marker.
*/
- tp->buttons.bottom_area.middlebutton_left_edge = width * 0.375 + xoffset;
- tp->buttons.bottom_area.rightbutton_left_edge = width * 0.625 + xoffset;
+ if (tp->device->model_flags & EVDEV_MODEL_DELL_TOUCHPAD) {
+ const int MIDDLE_BUTTON_WIDTH = 10; /* mm */
+ int half_width = MIDDLE_BUTTON_WIDTH/2 * xres; /* units */
+
+ mb_le = xoffset + width/2 - half_width;
+ mb_re = xoffset + width/2 + half_width;
+ } else {
+ mb_le = xoffset + width * 0.375;
+ mb_re = xoffset + width * 0.625;
+ }
+
+ tp->buttons.bottom_area.middlebutton_left_edge = mb_le;
+ tp->buttons.bottom_area.rightbutton_left_edge = mb_re;
}
void
diff --git a/src/evdev.c b/src/evdev.c
index fdbaba13..6d231db6 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1804,6 +1804,7 @@ evdev_read_model_flags(struct evdev_device *device)
MODEL(CYBORG_RAT),
MODEL(CYAPA),
MODEL(LENOVO_T450_TOUCHPAD),
+ MODEL(DELL_TOUCHPAD),
MODEL(TRACKBALL),
MODEL(APPLE_MAGICMOUSE),
{ NULL, EVDEV_MODEL_DEFAULT },
diff --git a/src/evdev.h b/src/evdev.h
index 939a0b86..a3e76c5f 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -115,6 +115,7 @@ enum evdev_device_model {
EVDEV_MODEL_CYBORG_RAT = (1 << 14),
EVDEV_MODEL_CYAPA = (1 << 15),
EVDEV_MODEL_LENOVO_T450_TOUCHPAD= (1 << 17),
+ EVDEV_MODEL_DELL_TOUCHPAD = (1 << 18),
EVDEV_MODEL_TRACKBALL = (1 << 19),
EVDEV_MODEL_APPLE_MAGICMOUSE = (1 << 20),
};
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
index 5e5ea9ab..ebce8d2b 100644
--- a/udev/90-libinput-model-quirks.hwdb
+++ b/udev/90-libinput-model-quirks.hwdb
@@ -48,6 +48,13 @@ libinput:mouse:input:b0003v06A3p0CD5*
LIBINPUT_MODEL_CYBORG_RAT=1
##########################################
+# Dell
+##########################################
+libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnDellInc.:*
+libinput:name:* Touchpad:dmi:*svnDellInc.:*
+ LIBINPUT_MODEL_DELL_TOUCHPAD=1
+
+##########################################
# Elantech
##########################################
libinput:name:*ETPS/2 Elantech Touchpad*:dmi:*