From 65c436407f37118618b348b9b7303b55322d66a2 Mon Sep 17 00:00:00 2001 From: José Expósito Date: Fri, 25 Feb 2022 17:30:31 +0100 Subject: pointer: transform low-res to high-res axis events Currently, the "wlr_event_pointer_axis" event stores low-resolution values in its "delta_discrete" field. Low-resolution values are always multiples of one, i.e., 1 for one wheel detent, 2 for two wheel detents, etc. In order to simplify internal handling of events, always transform in the backend from the low-resolution value into the high-resolution value. The transformation is performed by multiplying by 120. The 120 magic number is used by the kernel and it is exposed to clients in the "WLR_POINTER_AXIS_DISCRETE_STEP" constant. --- backend/libinput/pointer.c | 1 + 1 file changed, 1 insertion(+) (limited to 'backend/libinput/pointer.c') diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index 124a4fda..b391b0e5 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -116,6 +116,7 @@ void handle_pointer_axis(struct libinput_event *event, libinput_event_pointer_get_axis_value(pevent, axes[i]); wlr_event.delta_discrete = libinput_event_pointer_get_axis_value_discrete(pevent, axes[i]); + wlr_event.delta_discrete *= WLR_POINTER_AXIS_DISCRETE_STEP; wlr_signal_emit_safe(&pointer->events.axis, &wlr_event); } } -- cgit v1.2.3