mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-22 02:50:34 +01:00
Remove spurious addition from range normalization calculation
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@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
1809baa59e
commit
a5d80f02f6
2 changed files with 4 additions and 4 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -438,13 +438,13 @@ START_TEST(normalization)
|
|||
litest_event(dev,
|
||||
EV_ABS,
|
||||
ABS_TILT_X,
|
||||
tilt_vertical_absinfo->maximum + 1);
|
||||
tilt_vertical_absinfo->maximum);
|
||||
|
||||
if (tilt_horizontal_absinfo != NULL)
|
||||
litest_event(dev,
|
||||
EV_ABS,
|
||||
ABS_TILT_Y,
|
||||
tilt_horizontal_absinfo->maximum + 1);
|
||||
tilt_horizontal_absinfo->maximum);
|
||||
|
||||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue