Skip to content

tablet: apply pressure offset handling for non-distance tablets

Peter Hutterer requested to merge whot/libinput:wip/tablet-auto-offset into main

Previously we only applied pressure offset handling for tablets that supported ABS_DISTANCE. Detecting a pressure offset when the tool doesn't actually touch the surface is easy after all.

But tablets without distance handling may also have a pressure offset, so let's try to detect this. This is obviously harder since the pen will always touch the tablet's surface whenever it is in proximity and thus will always have some pressure applied to it.

The process here is to merely observe the minimum pressure value during the first two strokes of the pen. On the third prox in, that minimum pressure value is taken as the offset. If the pressure drops below the offset, the offset is adjusted downwards [1] so over time we'll get closer to the pen's real offset.

[1] this is already done for distance tablets too

Fixes #834 (closed), partially, cc @bjornfor - you need a quirk to disable ABS_DISTANCE and it won't take effect on that particular pen because the threshold is still at 20%, not 50% so for testing you'd need to hack that bit.

Note: did some manual testing but I have to hack my device quite a bit to get something that triggers these conditions, so... It does pass the test suite.

Edited by Peter Hutterer

Merge request reports