From 4ec31ce56adf6cd36cc7e31306fb9d0d1bb1b4f9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 24 Sep 2013 15:57:29 +0200 Subject: [PATCH] evdevtouch: Avoid duplicating points in released state Points in released state should only be removed from m_contacts after the disappeared-since-last-sync is done. Otherwise the same point can appear twice (both times in released state) in the same event. Change-Id: Ia751054c3fe893006a090bdce96a64738d8388ac Reviewed-by: Gunnar Sletta --- .../input/evdevtouch/qevdevtouch.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp index 08f9860ccf..a7502fbcc0 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -271,6 +271,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, d->hw_pressure_max = absInfo.maximum; } } + char name[1024]; if (ioctl(m_fd, EVIOCGNAME(sizeof(name) - 1), name) >= 0) { d->hw_name = QString::fromLocal8Bit(name); @@ -452,9 +453,6 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) } addTouchPoint(contact, &combinedStates); - - if (contact.state == Qt::TouchPointReleased) - it.remove(); } // Now look for contacts that have disappeared since the last sync. @@ -469,6 +467,15 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) } } + // Remove contacts that have just been reported as released. + it = m_contacts; + while (it.hasNext()) { + it.next(); + Contact &contact(it.value()); + if (contact.state == Qt::TouchPointReleased) + it.remove(); + } + m_lastContacts = m_contacts; if (!m_typeB && !m_singleTouch) m_contacts.clear();