From 3ad59bc297425779256a2817cfa9b0b631128e69 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 30 Jun 2016 10:11:17 +1000 Subject: [PATCH libinput] 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 --- src/evdev-mt-touchpad-buttons.c | 24 +++++++++++++++++++++--- src/evdev.c | 1 + src/evdev.h | 1 + udev/90-libinput-model-quirks.hwdb | 7 +++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index a9b7521..78a2e92 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; @@ -568,9 +570,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 b4a1088..60f8c95 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 ca13318..b5abbc5 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -114,6 +114,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 5e5ea9a..ebce8d2 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:* -- 2.7.4