mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-25 17:30:06 +01:00
filter: drop delta-softening
I doubt this does what we think it does. It doesn't soften the delta changes, rather it introduces bumps in the smooth processing of the changes. abs(delta) below 1.0 is untouched, and abs(delta) beyond 3 or 4 isn't noticable much. But in the slow range around the 1/-1 mark there is a bump. For example, if our last_delta is 1.0 and delta is 1.1, the "softened" delta is set to 0.6. That is stored as last delta, so an input sequence of: 0.8, 0.9, 1.0, 1.1, 1.2, 1.0, 0.8, 1.1 results in "softened" deltas that don't match the input: 0.8, 0.9, 1.0, 0.6, 0.7, 1.0, 0.8, 0.6 A better approach at smoothing this out would be to calculate the softened as: current = current ± diff(last, current) * 0.5 or even weighted towards the new delta current = current ± diff(last, current) * 0.25 In tests, this makes little difference. Dropping this function altogether is sufficient to make the pointer pointer behave slightly better at low speeds though the increase is small enough to attribute to confirmation bias. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
e4d50a73a1
commit
f2dfbc0b82
1 changed files with 0 additions and 23 deletions
23
src/filter.c
23
src/filter.c
|
|
@ -257,27 +257,6 @@ calculate_acceleration(struct pointer_accelerator *accel,
|
|||
return factor;
|
||||
}
|
||||
|
||||
static double
|
||||
soften_delta(double last_delta, double delta)
|
||||
{
|
||||
if (delta < -1.0 || delta > 1.0) {
|
||||
if (delta > last_delta)
|
||||
return delta - 0.5;
|
||||
else if (delta < last_delta)
|
||||
return delta + 0.5;
|
||||
}
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
||||
static void
|
||||
apply_softening(struct pointer_accelerator *accel,
|
||||
struct motion_params *motion)
|
||||
{
|
||||
motion->dx = soften_delta(accel->last_dx, motion->dx);
|
||||
motion->dy = soften_delta(accel->last_dy, motion->dy);
|
||||
}
|
||||
|
||||
static void
|
||||
accelerator_filter(struct motion_filter *filter,
|
||||
struct motion_params *motion,
|
||||
|
|
@ -295,8 +274,6 @@ accelerator_filter(struct motion_filter *filter,
|
|||
motion->dx = accel_value * motion->dx;
|
||||
motion->dy = accel_value * motion->dy;
|
||||
|
||||
apply_softening(accel, motion);
|
||||
|
||||
accel->last_dx = motion->dx;
|
||||
accel->last_dy = motion->dy;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue