evdev: use fabs(x) instead of (x <= -a || x >= a)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2014-11-10 08:44:11 +10:00
parent ffad279751
commit 697d25e9e2

View 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);