mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-07 13:08:04 +02:00
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 <peter.hutterer@who-t.net>
This commit is contained in:
parent
d75a0fa42d
commit
a5b6f4009b
1 changed files with 1 additions and 1 deletions
|
|
@ -365,7 +365,7 @@ normalize_pressure(const struct input_absinfo *absinfo,
|
||||||
* threshold is 0 pressure.
|
* threshold is 0 pressure.
|
||||||
*/
|
*/
|
||||||
int base = tool->pressure.threshold.lower;
|
int base = tool->pressure.threshold.lower;
|
||||||
double range = absinfo->maximum - base;
|
double range = absinfo->maximum - base + 1;
|
||||||
double value = (absinfo->value - base) / range;
|
double value = (absinfo->value - base) / range;
|
||||||
|
|
||||||
return max(0.0, value);
|
return max(0.0, value);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue