mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-06 22:20:17 +01:00
Rename delta_coords to device_float_coords
What we really need is not a specific delta type, but a type which can hold non discrete device coordinates, this is e.g. also needed for the center coordinates of gestures. So rename delta_coords to device_float_coords to properly reflect what we really need. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
9f353b6678
commit
209215946b
3 changed files with 20 additions and 20 deletions
|
|
@ -244,20 +244,20 @@ tp_estimate_delta(int x0, int x1, int x2, int x3)
|
|||
struct normalized_coords
|
||||
tp_get_delta(struct tp_touch *t)
|
||||
{
|
||||
struct delta_coords delta;
|
||||
struct device_float_coords delta;
|
||||
const struct normalized_coords zero = { 0.0, 0.0 };
|
||||
|
||||
if (t->history.count < TOUCHPAD_MIN_SAMPLES)
|
||||
return zero;
|
||||
|
||||
delta.dx = tp_estimate_delta(tp_motion_history_offset(t, 0)->x,
|
||||
tp_motion_history_offset(t, 1)->x,
|
||||
tp_motion_history_offset(t, 2)->x,
|
||||
tp_motion_history_offset(t, 3)->x);
|
||||
delta.dy = tp_estimate_delta(tp_motion_history_offset(t, 0)->y,
|
||||
tp_motion_history_offset(t, 1)->y,
|
||||
tp_motion_history_offset(t, 2)->y,
|
||||
tp_motion_history_offset(t, 3)->y);
|
||||
delta.x = tp_estimate_delta(tp_motion_history_offset(t, 0)->x,
|
||||
tp_motion_history_offset(t, 1)->x,
|
||||
tp_motion_history_offset(t, 2)->x,
|
||||
tp_motion_history_offset(t, 3)->x);
|
||||
delta.y = tp_estimate_delta(tp_motion_history_offset(t, 0)->y,
|
||||
tp_motion_history_offset(t, 1)->y,
|
||||
tp_motion_history_offset(t, 2)->y,
|
||||
tp_motion_history_offset(t, 3)->y);
|
||||
|
||||
return tp_normalize_delta(t->tp, delta);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,12 +275,12 @@ struct tp_dispatch {
|
|||
for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++)
|
||||
|
||||
static inline struct normalized_coords
|
||||
tp_normalize_delta(struct tp_dispatch *tp, struct delta_coords delta)
|
||||
tp_normalize_delta(struct tp_dispatch *tp, struct device_float_coords delta)
|
||||
{
|
||||
struct normalized_coords normalized;
|
||||
|
||||
normalized.x = delta.dx * tp->accel.x_scale_coeff;
|
||||
normalized.y = delta.dy * tp->accel.y_scale_coeff;
|
||||
normalized.x = delta.x * tp->accel.x_scale_coeff;
|
||||
normalized.y = delta.y * tp->accel.y_scale_coeff;
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@ struct device_coords {
|
|||
};
|
||||
|
||||
/*
|
||||
* A delta between 2 device coordinates,
|
||||
* may be non-discrete because of averaging.
|
||||
* A coordinate pair in device coordinates, capable of holding non discrete
|
||||
* values, this is necessary e.g. when device coordinates get averaged.
|
||||
*/
|
||||
struct delta_coords {
|
||||
double dx, dy;
|
||||
struct device_float_coords {
|
||||
double x, y;
|
||||
};
|
||||
|
||||
/* A dpi-normalized coordinate pair */
|
||||
|
|
@ -363,13 +363,13 @@ libinput_now(struct libinput *libinput)
|
|||
return ts.tv_sec * 1000ULL + ts.tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
static inline struct delta_coords
|
||||
static inline struct device_float_coords
|
||||
device_delta(struct device_coords a, struct device_coords b)
|
||||
{
|
||||
struct delta_coords delta;
|
||||
struct device_float_coords delta;
|
||||
|
||||
delta.dx = a.x - b.x;
|
||||
delta.dy = a.y - b.y;
|
||||
delta.x = a.x - b.x;
|
||||
delta.y = a.y - b.y;
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue