Drop vector_length(), replace with hypot(3)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2015-07-20 11:09:19 +10:00
parent b0b11a286d
commit ae32e0a17b
3 changed files with 2 additions and 8 deletions

View file

@ -439,7 +439,7 @@ tp_unpin_finger(struct tp_dispatch *tp, struct tp_touch *t)
ydist *= tp->buttons.motion_dist.y_scale_coeff;
/* 3mm movement -> unpin */
if (vector_length(xdist, ydist) >= 3.0) {
if (hypot(xdist, ydist) >= 3.0) {
t->pinned.is_pinned = false;
return;
}

View file

@ -299,10 +299,4 @@ int parse_mouse_wheel_click_angle_property(const char *prop);
double parse_trackpoint_accel_property(const char *prop);
bool parse_dimension_property(const char *prop, size_t *width, size_t *height);
static inline double
vector_length(double x, double y)
{
return sqrt(x * x + y * y);
}
#endif /* LIBINPUT_UTIL_H */

View file

@ -197,7 +197,7 @@ START_TEST(pointer_motion_relative_min_decel)
ck_assert((evx == 0.0) == (dx == 0));
ck_assert((evy == 0.0) == (dy == 0));
len = vector_length(evx, evy);
len = hypot(evx, evy);
ck_assert(fabs(len) >= 0.3);
libinput_event_destroy(event);