aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2022-03-27 19:04:45 +0200
committerJosé Expósito <jose.exposito89@gmail.com>2022-07-11 11:01:35 +0200
commit40dc5121aa4cc76ed9a6ededd6ff56570c1a2e40 (patch)
tree64e7d91a41c8044481ec33638628869f4ceee23b
parent11f49b6b6a4c0d269c502738fd8b5bc6fd187768 (diff)
seat: support high-resolution clients
Upgrade the seat protocol to version 8 and handle clients that support high-resolution scroll wheel events. Since the backend already sends discrete values in the 120 range, forwarding them is enough.
-rw-r--r--types/seat/wlr_seat.c2
-rw-r--r--types/seat/wlr_seat_pointer.c24
2 files changed, 19 insertions, 7 deletions
diff --git a/types/seat/wlr_seat.c b/types/seat/wlr_seat.c
index 5280bc46..d7652c12 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 d4ec3844..1ddc1467 100644
--- a/types/seat/wlr_seat_pointer.c
+++ b/types/seat/wlr_seat_pointer.c
@@ -269,6 +269,14 @@ uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
return serial;
}
+static void send_axis_value120(struct wl_resource *resource, uint32_t time,
+ enum wlr_axis_orientation orientation, double value,
+ int32_t value_discrete) {
+ wl_pointer_send_axis_value120(resource, orientation, value_discrete);
+ wl_pointer_send_axis(resource, time, orientation,
+ wl_fixed_from_double(value));
+}
+
void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
enum wlr_axis_orientation orientation, double value,
int32_t value_discrete, enum wlr_axis_source source) {
@@ -298,14 +306,18 @@ 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,
+ if (value_discrete) {
+ if (version >= WL_POINTER_AXIS_VALUE120_SINCE_VERSION) {
+ send_axis_value120(resource, time, orientation, value,
+ value_discrete);
+ } else if (version >= WL_POINTER_AXIS_DISCRETE_SINCE_VERSION) {
+ wl_pointer_send_axis_discrete(resource, orientation,
value_discrete / WLR_POINTER_AXIS_DISCRETE_STEP);
+ }
+ } else {
+ wl_pointer_send_axis(resource, time, orientation,
+ wl_fixed_from_double(value));
}
-
- wl_pointer_send_axis(resource, time, orientation,
- wl_fixed_from_double(value));
} else if (version >= WL_POINTER_AXIS_STOP_SINCE_VERSION) {
wl_pointer_send_axis_stop(resource, time, orientation);
}