[PATCH] Remove spurious addition from range normalization calculation

Peter Hutterer peter.hutterer at who-t.net
Sun Dec 7 18:37:44 PST 2014


On Fri, Dec 05, 2014 at 03:13:34PM -0800, Jason Gerecke wrote:
> The presence of a "+1" in the range calculation prevents the
> normalization functions from returning a value of "1.0" when
> absinfo->value has reached its maximum.
> 
> Signed-off-by: Jason Gerecke <killertofu at gmail.com>
> ---

whoopsy. merged, thanks.

Cheers,
   Peter

>  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 */
> -- 
> 2.1.3
> 


More information about the wayland-devel mailing list