evdev: use fabs(x) instead of (x <= -a || x >= a)
authorPeter Hutterer <peter.hutterer@who-t.net>
Sun, 9 Nov 2014 22:44:11 +0000 (08:44 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 11 Nov 2014 00:00:56 +0000 (10:00 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
src/evdev.c

index 222d6b1..89a39ca 100644 (file)
@@ -1517,11 +1517,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);