summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-06-26 09:27:20 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-06-26 11:10:28 +1000
commit7ebb718ee9dfe84b02e4e8cecb6854b620808822 (patch)
tree6830e59fcf045496d1bd62668ef3975baf0251e5 /src
parentffaf1f3b725cd7aa27a8dc05fdc9a9f3b60c6f77 (diff)
downloadlibinput-7ebb718ee9dfe84b02e4e8cecb6854b620808822.tar.gz
evdev: move posting a trackpoint scroll event into a helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/evdev.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 9e2909c3..63d2ca8e 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -254,6 +254,23 @@ normalize_delta(struct evdev_device *device,
normalized->y = delta->y * DEFAULT_MOUSE_DPI / (double)device->dpi;
}
+static inline bool
+evdev_post_trackpoint_scroll(struct evdev_device *device,
+ struct normalized_coords unaccel,
+ uint64_t time)
+{
+ if (device->scroll.method != LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN ||
+ !hw_is_key_down(device, device->scroll.button))
+ return false;
+
+ if (device->scroll.button_scroll_active)
+ evdev_post_scroll(device, time,
+ LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS,
+ &unaccel);
+
+ return true;
+}
+
static void
evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
{
@@ -276,14 +293,8 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
device->rel.y = 0;
/* Use unaccelerated deltas for pointing stick scroll */
- if (device->scroll.method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN &&
- hw_is_key_down(device, device->scroll.button)) {
- if (device->scroll.button_scroll_active)
- evdev_post_scroll(device, time,
- LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS,
- &unaccel);
- break;
- }
+ if (evdev_post_trackpoint_scroll(device, unaccel, time))
+ break;
/* Apply pointer acceleration. */
accel = filter_dispatch(device->pointer.filter,