From 6a93c74a415e9ae7bb48bd91cd6aaccbbe0dafe1 Mon Sep 17 00:00:00 2001 From: Tuomas Vaarala Date: Tue, 18 Aug 2020 14:26:35 +0300 Subject: [PATCH] evdev: Do not take m_prevInvalid into account with absolute coordinates If QT_QPA_EVDEV_MOUSE_PARAMETERS=abs is used to force qevdevmousehandler to use absolute coordinates, the first event coordinates are incorrect (0,0) Fixes: QTBUG-86104 Change-Id: I9352e809a4a62b15adcf279b00f2d07a72257012 Reviewed-by: Janne Roine (cherry picked from commit de2706fa35fa0d9f43d97b7aa6a7c30d1bb22e33) Reviewed-by: Qt Cherry-pick Bot --- .../input/evdevmouse/qevdevmousehandler.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp index 8d98cb1e8cb..c22a85159b6 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp @@ -159,17 +159,15 @@ void QEvdevMouseHandler::sendMouseEvent() if (!m_abs) { x = m_x - m_prevx; y = m_y - m_prevy; - } - else { + if (m_prevInvalid) { + x = y = 0; + m_prevInvalid = false; + } + } else { x = m_x / m_hardwareScalerX; y = m_y / m_hardwareScalerY; } - if (m_prevInvalid) { - x = y = 0; - m_prevInvalid = false; - } - if (m_eventType == QEvent::MouseMove) emit handleMouseEvent(x, y, m_abs, m_buttons, Qt::NoButton, m_eventType); else