mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 05:58:01 +02:00
touchpad: return normalized deltas from tp_get_delta
All callers except the tap motion threshold call tp_get_delta() followed by tp_filter_motion() - the latter normalized it before calling into the accleration code. Move the normalization into tp_get_delta() so we don't deal with device-specific coordinates but normalized deltas instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
37af67c666
commit
3f7efc134e
2 changed files with 10 additions and 2 deletions
|
|
@ -64,8 +64,8 @@ tp_filter_motion(struct tp_dispatch *tp,
|
||||||
{
|
{
|
||||||
struct motion_params motion;
|
struct motion_params motion;
|
||||||
|
|
||||||
motion.dx = *dx * tp->accel.x_scale_coeff;
|
motion.dx = *dx;
|
||||||
motion.dy = *dy * tp->accel.y_scale_coeff;
|
motion.dy = *dy;
|
||||||
|
|
||||||
if (dx_unaccel)
|
if (dx_unaccel)
|
||||||
*dx_unaccel = motion.dx;
|
*dx_unaccel = motion.dx;
|
||||||
|
|
@ -269,6 +269,7 @@ tp_get_delta(struct tp_touch *t, double *dx, double *dy)
|
||||||
tp_motion_history_offset(t, 1)->y,
|
tp_motion_history_offset(t, 1)->y,
|
||||||
tp_motion_history_offset(t, 2)->y,
|
tp_motion_history_offset(t, 2)->y,
|
||||||
tp_motion_history_offset(t, 3)->y);
|
tp_motion_history_offset(t, 3)->y);
|
||||||
|
tp_normalize_delta(t->tp, dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -283,6 +283,13 @@ struct tp_dispatch {
|
||||||
#define tp_for_each_touch(_tp, _t) \
|
#define tp_for_each_touch(_tp, _t) \
|
||||||
for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++)
|
for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++)
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
tp_normalize_delta(struct tp_dispatch *tp, double *dx, double *dy)
|
||||||
|
{
|
||||||
|
*dx = *dx * tp->accel.x_scale_coeff;
|
||||||
|
*dy = *dy * tp->accel.y_scale_coeff;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tp_get_delta(struct tp_touch *t, double *dx, double *dy);
|
tp_get_delta(struct tp_touch *t, double *dx, double *dy);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue