From 16e46e19e08b98516c2f4f469dfc160aca8db474 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 5 May 2023 20:54:37 +0300 Subject: [PATCH] wayland: Avoid losing precision in tablet events globalPos() is rounded version of globalPosF(). --- src/input.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index 280f0fdfcc..fba730b47e 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -697,7 +697,7 @@ public: } switch (event->type()) { case QEvent::TabletMove: - window->updateInteractiveMoveResize(event->globalPos()); + window->updateInteractiveMoveResize(event->globalPosF()); break; case QEvent::TabletRelease: window->endInteractiveMoveResize(); @@ -1755,7 +1755,7 @@ public: bool wasAction = false; const Options::MouseCommand command = window->getMouseCommand(Qt::LeftButton, &wasAction); if (wasAction) { - return !window->performMouseCommand(command, event->globalPos()); + return !window->performMouseCommand(command, event->globalPosF()); } return false; } @@ -2206,7 +2206,7 @@ public: // may still happen (e.g. Release or ProximityOut events) auto tablet = static_cast(event->tabletId().m_deviceGroupData); - Window *window = input()->findToplevel(event->globalPos()); + Window *window = input()->findToplevel(event->globalPosF()); if (!window || !window->surface()) { return false; } @@ -2222,11 +2222,11 @@ public: case QEvent::TabletMove: { const auto pos = window->mapToLocal(event->globalPosF()); tool->sendMotion(pos); - m_cursorByTool[tool]->setPos(event->globalPos()); + m_cursorByTool[tool]->setPos(event->globalPosF()); break; } case QEvent::TabletEnterProximity: { - const QPoint pos = event->globalPos(); + const QPointF pos = event->globalPosF(); m_cursorByTool[tool]->setPos(pos); tool->sendProximityIn(tablet); tool->sendMotion(window->mapToLocal(event->globalPosF())); @@ -2238,7 +2238,7 @@ public: case QEvent::TabletPress: { const auto pos = window->mapToLocal(event->globalPosF()); tool->sendMotion(pos); - m_cursorByTool[tool]->setPos(event->globalPos()); + m_cursorByTool[tool]->setPos(event->globalPosF()); tool->sendDown(); break; }