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>
This commit is contained in:
Peter Hutterer 2016-06-30 10:11:17 +10:00
parent 3141b8437e
commit caf14fab16
4 changed files with 30 additions and 3 deletions

View file

@ -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

View file

@ -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 },

View file

@ -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),
};

View file

@ -47,6 +47,13 @@ libinput:mouse:input:b0005v05ACp030D*
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
##########################################