tablet: scale the available pressure range into the pressure thresholds
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 6 Aug 2019 04:04:16 +0000 (14:04 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 8 Aug 2019 03:58:54 +0000 (13:58 +1000)
commitd93feba134dbabbac37d375c972699f6ae5c1bc2
treeed8dca70b2972820736fc9a67e86b6ba5a4b6c47
parent78efec3d2f855ade6c416d0f8c4a0cd6afd31289
tablet: scale the available pressure range into the pressure thresholds

Pens that don't have a pressure offset (caused by a worn-out tip) still have
basic pressure thresholds to avoid tip events when we're still a bit away from
the tablet or barely touching it. That range is currently 5% of the pressure
for tip down, 1% for tip up.

This leaves us with 95% of the range and that needs to be scaled correctly,
otherwise the bottom 5% happen before a tip event and are inaccessible where
applications don't look at pressure before tip down.

Fixes #332

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-tablet.c
test/test-tablet.c