mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-11 00:30:19 +01:00
touchpad: normalize the touchpad resolution to 400dpi, not 10 units/mm
In an attempt to bring method into the madness, normalize the touchpad deltas to those of a USB mouse with 400 dpi. This way the data we're dealing with in the acceleration code is of a known quantity. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
468e628808
commit
e874d09b49
3 changed files with 18 additions and 8 deletions
|
|
@ -663,14 +663,17 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal)
|
|||
|
||||
/*
|
||||
* Not all touchpads report the same amount of units/mm (resolution).
|
||||
* Normalize motion events to a resolution of 10 units/mm as base
|
||||
* (unaccelerated) speed. This also evens out any differences in x
|
||||
* and y resolution, so that a circle on the touchpad does not turn
|
||||
* into an elipse on the screen.
|
||||
* Normalize motion events to a resolution of 15.74 units/mm
|
||||
* (== 400 dpi) as base (unaccelerated) speed. This also evens out any
|
||||
* differences in x and y resolution, so that a circle on the
|
||||
* touchpad does not turn into an elipse on the screen.
|
||||
*
|
||||
* We pick 400dpi as thats one of the many default resolutions
|
||||
* for USB mice, so we end up with a similar base speed on the device.
|
||||
*/
|
||||
if (res_x > 1 && res_y > 1) {
|
||||
tp->accel.x_scale_coeff = 10.0 / res_x;
|
||||
tp->accel.y_scale_coeff = 10.0 / res_y;
|
||||
tp->accel.x_scale_coeff = (400/25.4) / res_x;
|
||||
tp->accel.y_scale_coeff = (400/25.4) / res_y;
|
||||
} else {
|
||||
/*
|
||||
* For touchpads where the driver does not provide resolution, fall
|
||||
|
|
|
|||
|
|
@ -341,7 +341,14 @@ pointer_accel_profile_smooth_simple(struct motion_filter *filter,
|
|||
if (accel < 1.0)
|
||||
accel = 1.0;
|
||||
|
||||
|
||||
/* We use units/ms as velocity but it has no real meaning unless all
|
||||
devices have the same resolution. For touchpads, we normalize to
|
||||
400dpi (15.75 units/mm), but the resolution on USB mice is all
|
||||
over the place. Though most mice these days have either 400
|
||||
dpi (15.75 units/mm), 800 dpi or 1000dpi, excluding gaming mice
|
||||
that can usually adjust it on the fly anyway and currently go up
|
||||
to 8200dpi.
|
||||
*/
|
||||
if (velocity < (threshold / 2.0))
|
||||
return calc_penumbral_gradient(0.5 + velocity / threshold) * 2.0 - 1.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include "config.h"
|
||||
|
||||
struct motion_params {
|
||||
double dx, dy;
|
||||
double dx, dy; /* in units/ms @ 400dpi */
|
||||
};
|
||||
|
||||
struct motion_filter;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue