[PATCH libinput 2.5/3] Move DEFAULT_MOUSE_DPI to evdev.h, provide a conversion macro

Hans de Goede hdegoede at redhat.com
Fri Mar 6 02:38:40 PST 2015


Hi,

On 06-03-15 06:41, Peter Hutterer wrote:
> Ideally we want to specify various thresholds in mm, but not all touchpads
> set the hardware resolutions. Rather than conditions to check for resolutions
> everywhere, use a macro to give us a normalized value that we use for motion
> as well.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>   src/evdev.h  | 6 ++++++
>   src/filter.h | 3 ---
>   2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/evdev.h b/src/evdev.h
> index 72082e5..cd530e4 100644
> --- a/src/evdev.h
> +++ b/src/evdev.h
> @@ -33,6 +33,12 @@
>   #include "libinput-private.h"
>   #include "timer.h"
>
> +/* The HW DPI rate we normalize to before calculating pointer acceleration */
> +#define DEFAULT_MOUSE_DPI 1000
> +

Ack to this bit.

> +/* Convert MM to a distance normalized to DEFAULT_MOUSE_DPI */
> +#define MM_TO_DPI_NORMALIZED(mm) (DEFAULT_MOUSE_DPI/25.4 * mm)
> +

As you rightfully remark in v2 of "touchpad: change tap motion threshold to 3 mm"

For touchpads this really ought to take the MAGIC factor into account.

Can you please:
1) move this to src/evdev-mt-touchpad.h (as that is where we want it anyways)
2) rename it to TP_MM_TO_DPI_NORMALIZED
3) Make the MAGIC factor a #define
4) Apply the MAGIC factor to TP_MM_TO_DPI_NORMALIZED, so that it actually
takes real mm rather then magic mm

>   enum evdev_event_type {
>   	EVDEV_NONE,
>   	EVDEV_ABSOLUTE_TOUCH_DOWN,
> diff --git a/src/filter.h b/src/filter.h
> index 9f6223d..9e90330 100644
> --- a/src/filter.h
> +++ b/src/filter.h
> @@ -28,9 +28,6 @@
>   #include <stdbool.h>
>   #include <stdint.h>
>
> -/* The HW DPI rate we normalize to before calculating pointer acceleration */
> -#define DEFAULT_MOUSE_DPI 1000
> -
>   struct motion_params {
>   	double dx, dy; /* in units/ms @ DEFAULT_MOUSE_DPI resolution */
>   };
>

Regards,

Hans


More information about the wayland-devel mailing list