diff options
author | José Expósito <jose.exposito89@gmail.com> | 2022-02-25 17:31:01 +0100 |
---|---|---|
committer | José Expósito <jose.exposito89@gmail.com> | 2022-07-11 11:01:35 +0200 |
commit | 11f49b6b6a4c0d269c502738fd8b5bc6fd187768 (patch) | |
tree | 89e5d8267edb43f473591a9ad37835b346adfc2b | |
parent | e00f042f801cf2f5f16bf2f8661d68b40e6d00e0 (diff) |
backend/wayland: handle high-res scroll events
Receive high-resolution scroll events from the parent compositor using
a Wayland listiner and emit the appropiate wlr_pointer signal.
-rw-r--r-- | backend/wayland/backend.c | 9 | ||||
-rw-r--r-- | backend/wayland/pointer.c | 12 |
2 files changed, 20 insertions, 1 deletions
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 998757f5..07df6912 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -346,8 +346,15 @@ static void registry_global(void *data, struct wl_registry *registry, wl->compositor = wl_registry_bind(registry, name, &wl_compositor_interface, 4); } else if (strcmp(iface, wl_seat_interface.name) == 0) { + uint32_t target_version = version; + if (version < 5) { + target_version = 5; + } + if (version > 8) { + target_version = 8; + } struct wl_seat *wl_seat = wl_registry_bind(registry, name, - &wl_seat_interface, 5); + &wl_seat_interface, target_version); if (!create_wl_seat(wl_seat, wl)) { wl_seat_destroy(wl_seat); } diff --git a/backend/wayland/pointer.c b/backend/wayland/pointer.c index 897f7108..b2f85459 100644 --- a/backend/wayland/pointer.c +++ b/backend/wayland/pointer.c @@ -187,6 +187,17 @@ static void pointer_handle_axis_discrete(void *data, pointer->axis_discrete = discrete * WLR_POINTER_AXIS_DISCRETE_STEP; } +static void pointer_handle_axis_value120(void *data, + struct wl_pointer *wl_pointer, uint32_t axis, int32_t value120) { + struct wlr_wl_seat *seat = data; + struct wlr_wl_pointer *pointer = seat->active_pointer; + if (pointer == NULL) { + return; + } + + pointer->axis_discrete = value120; +} + static const struct wl_pointer_listener pointer_listener = { .enter = pointer_handle_enter, .leave = pointer_handle_leave, @@ -197,6 +208,7 @@ static const struct wl_pointer_listener pointer_listener = { .axis_source = pointer_handle_axis_source, .axis_stop = pointer_handle_axis_stop, .axis_discrete = pointer_handle_axis_discrete, + .axis_value120 = pointer_handle_axis_value120, }; static void gesture_swipe_begin(void *data, |