From 92af4c8d2b4326b5fe420b40950ddfd96d940f81 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 4 Sep 2024 15:09:11 +0200 Subject: [PATCH] client: Reset tablet state on proximity out; quiet the warning If !m_pending.proximitySurface, usually it's because the stylus is leaving proximity. The "no proximity surface" warning (introduced in 4d844d36404597713a63879dc24f051de0ad3e5b) only makes sense if neither applied nor pending state has a proximity service. If we are leaving proximity, reset m_applied state as well as m_pending state, because we don't expect any more tablet events until after the next proximity in event. There was a bug that subsequent proximity in events were not sent, because m_applied.proximitySurface was still set (leftover state). Amends bb151390240c1f20a6464adbefa497f3559554dd Pick-to: 6.8 Change-Id: I019e91eebb1958cd6c17393482cbae4c4ba9308d Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandtabletv2.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index f4870217e00..1a05eb8b963 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -348,10 +348,13 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_button(uint32_t serial, uint32_t b void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) { if (!m_pending.proximitySurface) { - qCWarning(lcQpaWayland) << "Can't send tablet event with no proximity surface, ignoring"; if (m_applied.enteredSurface) { + // leaving proximity QWindowSystemInterface::handleTabletEnterLeaveProximityEvent(nullptr, this, false); m_pending = State(); // Don't leave pressure etc. lying around when we enter the next surface + m_applied = State(); + } else { + qCWarning(lcQpaWayland) << "Can't send tablet event with no proximity surface, ignoring"; } return; }