mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 02:19:49 +01:00
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.
This commit is contained in:
parent
11f49b6b6a
commit
40dc5121aa
2 changed files with 19 additions and 7 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue