From a5b6f4009bdcac3ec0359568c40cbb3a6bdf4609 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 28 Aug 2023 09:05:38 +1000 Subject: [PATCH] tablet: fix the pressure offset range being off by one Kernel ranges are inclusiv min/max, so let's make sure we calculate that correctly. Signed-off-by: Peter Hutterer --- src/evdev-tablet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 7cfa424c..ff33823f 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -365,7 +365,7 @@ normalize_pressure(const struct input_absinfo *absinfo, * threshold is 0 pressure. */ int base = tool->pressure.threshold.lower; - double range = absinfo->maximum - base; + double range = absinfo->maximum - base + 1; double value = (absinfo->value - base) / range; return max(0.0, value);