summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2016-05-12 16:21:30 -0500
committerDerek Foreman <derekf@osg.samsung.com>2016-05-13 16:36:42 -0500
commit1a339c9e5918f6d8672755d566cac622f1d9c2d3 (patch)
tree0ccd7f07a3f79305ebd3f3da2f9f4829e744abca
parent4214193bd4b389b5564dbac02fcf05eb46ea161a (diff)
ecore_drm: Handle wheel scrolling separately from finger scrolling
Wheels are discrete and scroll in clicks, fingers are continuous and scroll in fractional pixels. This change causes wheel based scrolling to be returned in "clicks" instead of "degrees" - allowing us to roll a single menu item with a click. It also will allow us to reduce the speed of two finger scrolling without messing up the speed of wheel scrolling.
-rw-r--r--src/lib/ecore_drm/ecore_drm_evdev.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c b/src/lib/ecore_drm/ecore_drm_evdev.c
index b389e5c..4e5ad45 100644
--- a/src/lib/ecore_drm/ecore_drm_evdev.c
+++ b/src/lib/ecore_drm/ecore_drm_evdev.c
@@ -585,6 +585,22 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin
585 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); 585 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
586} 586}
587 587
588#if LIBINPUT_HIGHER_08
589static double
590_event_scroll_get(struct libinput_event_pointer *pe, enum libinput_pointer_axis axis)
591{
592 switch (libinput_event_pointer_get_axis_source(pe))
593 {
594 case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
595 return libinput_event_pointer_get_axis_value_discrete(pe, axis);
596 case LIBINPUT_POINTER_AXIS_SOURCE_FINGER:
597 case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
598 return libinput_event_pointer_get_axis_value(pe, axis);
599 }
600 return 0.0;
601}
602#endif
603
588static void 604static void
589_device_handle_axis(struct libinput_device *device, struct libinput_event_pointer *event) 605_device_handle_axis(struct libinput_device *device, struct libinput_event_pointer *event)
590{ 606{
@@ -618,13 +634,13 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe
618#if LIBINPUT_HIGHER_08 634#if LIBINPUT_HIGHER_08
619 axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; 635 axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
620 if (libinput_event_pointer_has_axis(event, axis)) 636 if (libinput_event_pointer_has_axis(event, axis))
621 ev->z = libinput_event_pointer_get_axis_value(event, axis); 637 ev->z = _event_scroll_get(event, axis);
622 638
623 axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL; 639 axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
624 if (libinput_event_pointer_has_axis(event, axis)) 640 if (libinput_event_pointer_has_axis(event, axis))
625 { 641 {
626 ev->direction = 1; 642 ev->direction = 1;
627 ev->z = libinput_event_pointer_get_axis_value(event, axis); 643 ev->z = _event_scroll_get(event, axis);
628 } 644 }
629#else 645#else
630 axis = libinput_event_pointer_get_axis(event); 646 axis = libinput_event_pointer_get_axis(event);