[PATCH] Remove spurious addition from range normalization calculation

Jason Gerecke killertofu at gmail.com
Fri Dec 5 15:13:34 PST 2014


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