diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index f57e1540e0..8424a040f3 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -641,6 +641,10 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) } } + bool preserveTouchPoints = false; + int lastTouchX = 0; + int lastTouchY = 0; + // Remove contacts that have just been reported as released. for (auto i = m_contacts.begin(), end = m_contacts.end(); i != end; /*erasing*/) { auto it = i++; @@ -651,10 +655,14 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) continue; if (contact.state == Qt::TouchPointReleased) { - if (m_typeB) + if (m_typeB) { contact.state = static_cast(0); - else + } else { m_contacts.erase(it); + lastTouchX = contact.x; + lastTouchY = contact.y; + preserveTouchPoints = true; + } } else { contact.state = Qt::TouchPointStationary; } @@ -667,6 +675,11 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) if (!m_touchPoints.isEmpty() && (hasPressure || combinedStates != Qt::TouchPointStationary)) reportPoints(); + + if (preserveTouchPoints) { + m_contacts[m_currentSlot].x = lastTouchX; + m_contacts[m_currentSlot].y = lastTouchY; + } } m_lastEventType = data->type;