[PATCH libinput] touchpad: reduce middle button size on Dell touchpads to 10mm
Yong Bakos
junk at humanoriented.com
Wed Jul 13 04:38:22 UTC 2016
On Jul 12, 2016, at 4:51 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
>
> 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 at who-t.net>
> Tested-by: Andy Lutomirski <luto at kernel.org>
This patch just adds the necessary evdev model and flag values; and the
logic for specifying the size of the Dell middle touchpad button. Makes
sense and is
Reviewed-by: Yong Bakos <ybakos at humanoriented.com>
yong
Reviewed-by: Yong Bakos <ybakos at humanoriented.com>
> ---
> 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 a2f3121..cf49c83 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 fdbaba1..6d231db 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 939a0b8..a3e76c5 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 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
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list