mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-25 17:30:06 +01:00
evdev: move posting a trackpoint scroll event into a helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
ffaf1f3b72
commit
7ebb718ee9
1 changed files with 19 additions and 8 deletions
27
src/evdev.c
27
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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue