[PATCH libinput 3/5] evdev: use fabs(x) instead of (x <= -a || x >= a)

Peter Hutterer peter.hutterer at who-t.net
Sun Nov 9 18:33:31 PST 2014


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

diff --git a/src/evdev.c b/src/evdev.c
index 9225163..424a590 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1526,11 +1526,11 @@ evdev_post_scroll(struct evdev_device *device,
 		  double dx,
 		  double dy)
 {
-	if (dy <= -device->scroll.threshold || dy >= device->scroll.threshold)
+	if (fabs(dy) >= device->scroll.threshold)
 		evdev_start_scrolling(device,
 				      LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
 
-	if (dx <= -device->scroll.threshold || dx >= device->scroll.threshold)
+	if (fabs(dx) >= device->scroll.threshold)
 		evdev_start_scrolling(device,
 				      LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
 
-- 
2.1.0



More information about the wayland-devel mailing list