summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2021-08-04 17:51:26 +0200
committerJosé Expósito <jose.exposito89@gmail.com>2021-08-04 17:51:26 +0200
commitca9042c7f08f8f0dc214b9cc19f3243728ec8c4a (patch)
tree6bf9d25927256f6776b52ad6855d36ef53c90642
parentbf8dc2e2ed0780b947eccfc9ac3694c518dee605 (diff)
Get scroll source in the event handler
Where libinput supports high-resolution scroll events, the scroll source is encoded in the event type. Get the scroll source in xf86libinput_handle_event to facilitate the migration. Refactor, no functional changes. Signed-off-by: José Expósito <jose.exposito89@gmail.com>
-rw-r--r--src/xf86libinput.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index adbc724..a8b7013 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -1631,15 +1631,14 @@ static inline bool
calculate_axis_value(struct xf86libinput *driver_data,
enum libinput_pointer_axis axis,
struct libinput_event_pointer *event,
+ enum libinput_pointer_axis_source source,
double *value_out)
{
- enum libinput_pointer_axis_source source;
double value;
if (!libinput_event_pointer_has_axis(event, axis))
return false;
- source = libinput_event_pointer_get_axis_source(event);
if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL) {
value = get_wheel_scroll_value(driver_data, event, axis);
} else {
@@ -1665,7 +1664,9 @@ calculate_axis_value(struct xf86libinput *driver_data,
}
static void
-xf86libinput_handle_axis(InputInfoPtr pInfo, struct libinput_event_pointer *event)
+xf86libinput_handle_axis(InputInfoPtr pInfo,
+ struct libinput_event_pointer *event,
+ enum libinput_pointer_axis_source source)
{
DeviceIntPtr dev = pInfo->dev;
struct xf86libinput *driver_data = pInfo->private;
@@ -1678,7 +1679,6 @@ xf86libinput_handle_axis(InputInfoPtr pInfo, struct libinput_event_pointer *even
valuator_mask_zero(mask);
- source = libinput_event_pointer_get_axis_source(event);
switch(source) {
case LIBINPUT_POINTER_AXIS_SOURCE_FINGER:
case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
@@ -1691,6 +1691,7 @@ xf86libinput_handle_axis(InputInfoPtr pInfo, struct libinput_event_pointer *even
if (calculate_axis_value(driver_data,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
event,
+ source,
&value))
valuator_mask_set_double(mask, 3, value);
@@ -1700,6 +1701,7 @@ xf86libinput_handle_axis(InputInfoPtr pInfo, struct libinput_event_pointer *even
if (calculate_axis_value(driver_data,
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
event,
+ source,
&value))
valuator_mask_set_double(mask, 2, value);
@@ -2381,7 +2383,8 @@ xf86libinput_handle_event(struct libinput_event *event)
break;
case LIBINPUT_EVENT_POINTER_AXIS:
xf86libinput_handle_axis(pInfo,
- libinput_event_get_pointer_event(event));
+ libinput_event_get_pointer_event(event),
+ libinput_event_pointer_get_axis_source(event));
break;
case LIBINPUT_EVENT_TOUCH_FRAME:
break;