From 5eedb9ea8b29d209b32b5bf80f788dce1d563e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Mon, 20 Sep 2021 19:47:21 +0200 Subject: [PATCH] seat: support hi-res clients using lo-res backends When the selected backend doesn't support high-resolution scroll, clients requesting high-resolution events must be handled properly. Upgrade the seat protocol to version 8 and change the defaul pointer axis handler to support new clients. --- types/seat/wlr_seat.c | 2 +- types/seat/wlr_seat_pointer.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/types/seat/wlr_seat.c b/types/seat/wlr_seat.c index f93147443..b5f1575a7 100644 --- a/types/seat/wlr_seat.c +++ b/types/seat/wlr_seat.c @@ -13,7 +13,7 @@ #include "util/global.h" #include "util/signal.h" -#define SEAT_VERSION 7 +#define SEAT_VERSION 8 static void seat_handle_get_pointer(struct wl_client *client, struct wl_resource *seat_resource, uint32_t id) { diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c index 27ece5e88..c20c52a89 100644 --- a/types/seat/wlr_seat_pointer.c +++ b/types/seat/wlr_seat_pointer.c @@ -298,10 +298,14 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time, wl_pointer_send_axis_source(resource, source); } if (value) { - if (value_discrete && - version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION) { - wl_pointer_send_axis_discrete(resource, orientation, - value_discrete); + if (value_discrete) { + if (version >= WL_POINTER_AXIS_VALUE120_SINCE_VERSION) { + wl_pointer_send_axis_value120(resource, orientation, + value_discrete * 120); + } else if (version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION) { + wl_pointer_send_axis_discrete(resource, orientation, + value_discrete); + } } wl_pointer_send_axis(resource, time, orientation,