[PATCH libinput] touchpad: reduce middle button size on Dell touchpads to 10mm

Hans de Goede hdegoede at redhat.com
Wed Jul 13 09:31:29 UTC 2016


Hi,

On 13-07-16 01:51, Peter Hutterer 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>

Patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans



> ---
>  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:*
>


More information about the wayland-devel mailing list