[PATCH libinput] tablet: Normalization functions can return 1.0

Peter Hutterer peter.hutterer at who-t.net
Sun Oct 12 04:05:07 PDT 2014


On Fri, Oct 10, 2014 at 12:45:32PM -0700, Bill Spitzak wrote:
> ---
>  src/evdev-tablet.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
> index ff5f737..9921823 100644
> --- a/src/evdev-tablet.c
> +++ b/src/evdev-tablet.c
> @@ -105,7 +105,7 @@ tablet_update_tool(struct tablet_dispatch *tablet,
>  
>  static inline double
>  normalize_pressure_or_dist(const struct input_absinfo * absinfo) {
> -	double range = absinfo->maximum - absinfo->minimum + 1;
> +	double range = absinfo->maximum - absinfo->minimum;
>  	double value = (absinfo->value - absinfo->minimum) / range;
>  
>  	return value;
> @@ -113,7 +113,7 @@ normalize_pressure_or_dist(const struct input_absinfo * absinfo) {
>  
>  static inline double
>  normalize_tilt(const struct input_absinfo * absinfo) {
> -	double range = absinfo->maximum - absinfo->minimum + 1;
> +	double range = absinfo->maximum - absinfo->minimum;
>  	double value = (absinfo->value - absinfo->minimum) / range;
>  
>  	/* Map to the (-1, 1) range */
> -- 
> 1.7.9.5

thanks for the patch, please sign off patches for libinput though (you can
send the patch directly to me to avoid ML traffic).

Also, please have a look in test/tablet.c to check if there's anything we
can add there to check for the correct normalization.

Cheers,
   Peter



More information about the wayland-devel mailing list