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 <gunnar.sletta@digia.com>
This commit is contained in:
Laszlo Agocs 2013-09-24 15:57:29 +02:00 committed by The Qt Project
parent e120ad442d
commit 4ec31ce56a

View File

@ -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();