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.
This commit is contained in:
José Expósito 2021-09-20 19:47:21 +02:00
parent 5128496ea8
commit 5eedb9ea8b
2 changed files with 9 additions and 5 deletions

View file

@ -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) {

View file

@ -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,