pointer: add high-resolution axis event

Starting with Linux Kernel v5.0 two new axes are available for
mice that support high-resolution wheel scrolling: REL_WHEEL_HI_RES and
REL_HWHEEL_HI_RES.

Both axes send data in fractions of 120 where each multiple of 120
amounts to one logical scroll event. Fractions of 120 indicate a wheel
movement less than one detent.

Three new events are now available on libinput:
LIBINPUT_EVENT_POINTER_SCROLL_WHEEL,
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, and
LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS.
These events replace the LIBINPUT_EVENT_POINTER_AXIS event, so new
clients should simply ignore that event.

Also, two new APIs are available to access the high-resolution data:
libinput_event_pointer_get_scroll_value() and
libinput_event_pointer_get_scroll_value_v120().

Create a new event, wlr_event_pointer_axis_v120, to represent
high-resolution axis events and a signal to emit them:
wlr_pointer->pointer.axis_value120.
This commit is contained in:
José Expósito 2021-09-20 19:45:48 +02:00
parent 9579d62a16
commit d0b8c111fd
2 changed files with 11 additions and 0 deletions

View file

@ -24,6 +24,7 @@ struct wlr_pointer {
struct wl_signal motion_absolute; // struct wlr_event_pointer_motion_absolute
struct wl_signal button; // struct wlr_event_pointer_button
struct wl_signal axis; // struct wlr_event_pointer_axis
struct wl_signal axis_value120; // struct wlr_event_pointer_axis_value120
struct wl_signal frame;
struct wl_signal swipe_begin; // struct wlr_event_pointer_swipe_begin
@ -80,6 +81,15 @@ struct wlr_event_pointer_axis {
int32_t delta_discrete;
};
struct wlr_event_pointer_axis_value120 {
struct wlr_input_device *device;
uint32_t time_msec;
enum wlr_axis_source source;
enum wlr_axis_orientation orientation;
double delta;
int32_t delta_value120;
};
struct wlr_event_pointer_swipe_begin {
struct wlr_input_device *device;
uint32_t time_msec;

View file

@ -11,6 +11,7 @@ void wlr_pointer_init(struct wlr_pointer *pointer,
wl_signal_init(&pointer->events.motion_absolute);
wl_signal_init(&pointer->events.button);
wl_signal_init(&pointer->events.axis);
wl_signal_init(&pointer->events.axis_value120);
wl_signal_init(&pointer->events.frame);
wl_signal_init(&pointer->events.swipe_begin);
wl_signal_init(&pointer->events.swipe_update);