diff options
author | Riteo <riteo@posteo.net> | 2024-02-22 16:32:23 +0100 |
---|---|---|
committer | Riteo <riteo@posteo.net> | 2024-02-28 13:08:31 +0100 |
commit | b01a36b3cd04499d959bbd169dec719e088a420a (patch) | |
tree | ba610c3c38afd65e1c5471cf48b7d307e4407a00 /platform/linuxbsd/wayland/wayland_thread.h | |
parent | 2e7fc81315bfa8d0a15f60adff2a12b6f3104236 (diff) | |
download | redot-engine-b01a36b3cd04499d959bbd169dec719e088a420a.tar.gz |
Wayland: Restore tablet support and handle multiple tools
This code was already partially there, although heavily incomplete and
nowadays commented out.
It got broken after the `WaylandThread` refactor and I didn't bother to
bring it over, preferring to `#if 0` it into oblivion for the time
being as I don't have a tablet/pen which support an eraser and tilt
reporting.
This commit brings it back and adds proper multi-tool support (needed
for eraser detection) thanks to winston-yallow, who could test this code
with their more capable tablet.
Diffstat (limited to 'platform/linuxbsd/wayland/wayland_thread.h')
-rw-r--r-- | platform/linuxbsd/wayland/wayland_thread.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/platform/linuxbsd/wayland/wayland_thread.h b/platform/linuxbsd/wayland/wayland_thread.h index f3e3c3a2ac..b9e7e0437a 100644 --- a/platform/linuxbsd/wayland/wayland_thread.h +++ b/platform/linuxbsd/wayland/wayland_thread.h @@ -322,10 +322,20 @@ public: // be used as a mouse...), but we'll hack one in with the current ticks. uint64_t button_time = 0; + uint64_t motion_time = 0; + + uint32_t proximity_serial = 0; + struct wl_surface *proximal_surface = nullptr; + }; + + struct TabletToolState { + struct wl_seat *wl_seat = nullptr; + + struct wl_surface *last_surface = nullptr; bool is_eraser = false; - bool in_proximity = false; - bool touching = false; + TabletToolData data_pending; + TabletToolData data; }; struct OfferState { @@ -425,9 +435,6 @@ public: struct zwp_tablet_seat_v2 *wp_tablet_seat = nullptr; List<struct zwp_tablet_tool_v2 *> tablet_tools; - - TabletToolData tablet_tool_data_buffer; - TabletToolData tablet_tool_data; }; struct CustomCursor { @@ -855,6 +862,7 @@ public: static WindowState *wl_surface_get_window_state(struct wl_surface *p_surface); static ScreenState *wl_output_get_screen_state(struct wl_output *p_output); static SeatState *wl_seat_get_seat_state(struct wl_seat *p_seat); + static TabletToolState *wp_tablet_tool_get_state(struct zwp_tablet_tool_v2 *p_tool); static OfferState *wl_data_offer_get_offer_state(struct wl_data_offer *p_offer); static OfferState *wp_primary_selection_offer_get_offer_state(struct zwp_primary_selection_offer_v1 *p_offer); |