From: Jonas Ådahl Date: Wed, 3 Oct 2012 20:56:58 +0000 (+0200) Subject: evdev: Update axis notifications to follow protocol X-Git-Tag: accepted/2.0alpha-wayland/20121115.181110~60 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b984e40c28021a83f93173bd01e7bf2492490136;p=profile%2Fivi%2Fweston.git evdev: Update axis notifications to follow protocol Signed-off-by: Jonas Ådahl --- diff --git a/src/evdev.c b/src/evdev.c index cc5af91..1c65b7b 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -30,6 +30,8 @@ #include "compositor.h" #include "evdev.h" +#define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int(10) + void evdev_led_update(struct evdev_device *device, enum weston_led leds) { @@ -161,17 +163,35 @@ evdev_process_relative(struct evdev_device *device, device->pending_events |= EVDEV_RELATIVE_MOTION; break; case REL_WHEEL: - notify_axis(device->seat, - time, - WL_POINTER_AXIS_VERTICAL_SCROLL, - wl_fixed_from_int(e->value)); + switch (e->value) { + case -1: + /* Scroll down */ + case 1: + /* Scroll up */ + notify_axis(device->seat, + time, + WL_POINTER_AXIS_VERTICAL_SCROLL, + -1 * e->value * DEFAULT_AXIS_STEP_DISTANCE); + break; + default: + break; + } break; case REL_HWHEEL: - notify_axis(device->seat, - time, - WL_POINTER_AXIS_HORIZONTAL_SCROLL, - wl_fixed_from_int(e->value)); - break; + switch (e->value) { + case -1: + /* Scroll left */ + case 1: + /* Scroll right */ + notify_axis(device->seat, + time, + WL_POINTER_AXIS_HORIZONTAL_SCROLL, + e->value * DEFAULT_AXIS_STEP_DISTANCE); + break; + default: + break; + + } } }