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 <davidedmundson@kde.org>
This commit is contained in:
Shawn Rutledge 2024-09-04 15:09:11 +02:00
parent 555fd6e1e1
commit 92af4c8d2b

View File

@ -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;
}