[PATCH libinput 2/3] touchpad: switch from fabs() to abs()

Peter Hutterer peter.hutterer at who-t.net
Mon Oct 24 01:45:18 UTC 2016


silence clang warning:
evdev-mt-touchpad.c:1017:7: warning: using floating point absolute value
function 'fabs' when argument is of integer type [-Wabsolute-value]

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 38b638b..7867122 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1013,8 +1013,8 @@ tp_detect_jumps(const struct tp_dispatch *tp, struct tp_touch *t)
 	/* called before tp_motion_history_push, so offset 0 is the most
 	 * recent coordinate */
 	last = tp_motion_history_offset(t, 0);
-	dx = fabs(t->point.x - last->x) / tp->device->abs.absinfo_x->resolution;
-	dy = fabs(t->point.y - last->y) / tp->device->abs.absinfo_y->resolution;
+	dx = 1.0 * abs(t->point.x - last->x) / tp->device->abs.absinfo_x->resolution;
+	dy = 1.0 * abs(t->point.y - last->y) / tp->device->abs.absinfo_y->resolution;
 
 	return hypot(dx, dy) > JUMP_THRESHOLD_MM;
 }
-- 
2.9.3



More information about the wayland-devel mailing list