From 857411f84e14ca7fe816d93ffa2c39fc617cddce Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 28 Nov 2016 09:44:04 +1000 Subject: [PATCH] Add wheel tilt as axis source Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/libinput.h | 15 +++++++++++++++ tools/event-debug.c | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/libinput.h b/src/libinput.h index 18a96bd4..aac93fcf 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -259,6 +259,12 @@ enum libinput_pointer_axis_source { * The event is caused by the motion of some device. */ LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, + /** + * The event is caused by the tilting of a mouse wheel rather than + * its rotation. This method is commonly used on mice without + * separate horizontal scroll wheels. + */ + LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT, }; /** @@ -1285,6 +1291,15 @@ libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event, * The coordinate system is identical to the cursor movement, i.e. a * scroll value of 1 represents the equivalent relative motion of 1. * + * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT, no + * terminating event is guaranteed (though it may happen). + * Scrolling is in discrete steps and there is no physical equivalent for + * the value returned here. For backwards compatibility, the value returned + * by this function is identical to a single mouse wheel rotation by this + * device (see the documentation for @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL + * above). Callers should not use this value but instead exclusively refer + * to the value returned by libinput_event_pointer_get_axis_value_discrete(). + * * For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS, * this function returns 0. * diff --git a/tools/event-debug.c b/tools/event-debug.c index d7d20188..a3e460a2 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -377,6 +377,9 @@ print_pointer_axis_event(struct libinput_event *ev) case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS: source = "continuous"; break; + case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT: + source = "tilt"; + break; } if (libinput_event_pointer_has_axis(p,