From de63a04367f1c831cfacac994ef21e23a1d5dad6 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Wed, 12 Jun 2024 15:42:09 +0200 Subject: [PATCH] QWaylandTablet: Update input device serial on events Fixes: QTBUG-118640 Pick-to: 6.8 6.7 Change-Id: I46ed31d85f9c80ac27ab9c161c23fcb429f82f43 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylandinputdevice_p.h | 1 + src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h index 91bcf405c53..06a9f55d163 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice_p.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice_p.h @@ -193,6 +193,7 @@ protected: friend class QWaylandPointerGestureSwipe; friend class QWaylandPointerGesturePinch; friend class QWaylandWindow; + friend class QWaylandTabletToolV2; }; inline uint32_t QWaylandInputDevice::serial() const diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 73524c1664c..aa942161431 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -153,7 +153,9 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_removed() void QWaylandTabletToolV2::zwp_tablet_tool_v2_proximity_in(uint32_t serial, zwp_tablet_v2 *tablet, wl_surface *surface) { Q_UNUSED(tablet); - Q_UNUSED(serial); + + m_tabletSeat->seat()->mSerial = serial; + if (Q_UNLIKELY(!surface)) { qCDebug(lcQpaWayland) << "Ignoring zwp_tablet_tool_v2_proximity_v2 with no surface"; return; @@ -172,6 +174,8 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_down(uint32_t serial) { m_pending.down = true; + m_tabletSeat->seat()->mSerial = serial; + if (m_pending.proximitySurface) { if (QWaylandWindow *window = m_pending.proximitySurface->waylandWindow()) { QWaylandInputDevice *seat = m_tabletSeat->seat(); @@ -230,7 +234,8 @@ static Qt::MouseButton mouseButtonFromTablet(uint button) void QWaylandTabletToolV2::zwp_tablet_tool_v2_button(uint32_t serial, uint32_t button, uint32_t state) { - Q_UNUSED(serial); + m_tabletSeat->seat()->mSerial = serial; + Qt::MouseButton mouseButton = mouseButtonFromTablet(button); if (state == button_state_pressed) m_pending.buttons |= mouseButton;