From 663f7342d6f589151bcf108668fab7330dfb22dc Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 3 Sep 2024 16:36:42 +0300 Subject: [PATCH] Move tablet cursor regardless whether the client supports tablet input It's a necessary prerequisite in order to make tablet tool event filtering work correctly. --- src/input.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index c15699c4ac..ac9a0fda1b 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -2314,6 +2314,16 @@ public: tool = createTool(event->tabletId()); } + switch (event->type()) { + case QEvent::TabletEnterProximity: + case QEvent::TabletPress: + case QEvent::TabletMove: + m_cursorByTool[tool]->setPos(event->globalPosition()); + break; + default: + break; + } + // NOTE: tablet will be nullptr as the device is removed (see ::removeDevice) but events from the tool // may still happen (e.g. Release or ProximityOut events) auto tablet = static_cast(event->tabletId().m_deviceGroupData); @@ -2334,12 +2344,9 @@ public: case QEvent::TabletMove: { const auto pos = window->mapToLocal(event->globalPosF()); tool->sendMotion(pos); - m_cursorByTool[tool]->setPos(event->globalPosF()); break; } case QEvent::TabletEnterProximity: { - const QPointF pos = event->globalPosF(); - m_cursorByTool[tool]->setPos(pos); tool->sendProximityIn(tablet); tool->sendMotion(window->mapToLocal(event->globalPosF())); break; @@ -2350,7 +2357,6 @@ public: case QEvent::TabletPress: { const auto pos = window->mapToLocal(event->globalPosF()); tool->sendMotion(pos); - m_cursorByTool[tool]->setPos(event->globalPosF()); tool->sendDown(); break; }