EvdevTouch: Don't remove released touch data for Type B; only ignore slot
The Type B protocol states that touch slots with an ID of -1 should be considered unused, but data should be retained if that slot becomes active again later. Instead of removing the contact from the contact list, only "disable" it. This contact can later be reused if the slot becomes active again. Change-Id: I827ae311841dd97f73a2c64d943658cd3f29eaf8 Done-with: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
parent
8cf9811ec3
commit
6c017d0a2b
@ -412,19 +412,31 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
|
||||
|
||||
if (data->code == ABS_MT_POSITION_X || (m_singleTouch && data->code == ABS_X)) {
|
||||
m_currentData.x = qBound(hw_range_x_min, data->value, hw_range_x_max);
|
||||
if (m_typeB || m_singleTouch)
|
||||
if (m_singleTouch)
|
||||
m_contacts[m_currentSlot].x = m_currentData.x;
|
||||
if (m_typeB) {
|
||||
m_contacts[m_currentSlot].x = m_currentData.x;
|
||||
if (m_contacts[m_currentSlot].state == Qt::TouchPointStationary)
|
||||
m_contacts[m_currentSlot].state = Qt::TouchPointMoved;
|
||||
}
|
||||
} else if (data->code == ABS_MT_POSITION_Y || (m_singleTouch && data->code == ABS_Y)) {
|
||||
m_currentData.y = qBound(hw_range_y_min, data->value, hw_range_y_max);
|
||||
if (m_typeB || m_singleTouch)
|
||||
if (m_singleTouch)
|
||||
m_contacts[m_currentSlot].y = m_currentData.y;
|
||||
if (m_typeB) {
|
||||
m_contacts[m_currentSlot].y = m_currentData.y;
|
||||
if (m_contacts[m_currentSlot].state == Qt::TouchPointStationary)
|
||||
m_contacts[m_currentSlot].state = Qt::TouchPointMoved;
|
||||
}
|
||||
} else if (data->code == ABS_MT_TRACKING_ID) {
|
||||
m_currentData.trackingId = data->value;
|
||||
if (m_typeB) {
|
||||
if (m_currentData.trackingId == -1)
|
||||
if (m_currentData.trackingId == -1) {
|
||||
m_contacts[m_currentSlot].state = Qt::TouchPointReleased;
|
||||
else
|
||||
} else {
|
||||
m_contacts[m_currentSlot].state = Qt::TouchPointPressed;
|
||||
m_contacts[m_currentSlot].trackingId = m_currentData.trackingId;
|
||||
}
|
||||
}
|
||||
} else if (data->code == ABS_MT_TOUCH_MAJOR) {
|
||||
m_currentData.maj = data->value;
|
||||
@ -468,8 +480,11 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
|
||||
it.next();
|
||||
Contact &contact(it.value());
|
||||
|
||||
if (!contact.state)
|
||||
continue;
|
||||
|
||||
int key = m_typeB ? it.key() : contact.trackingId;
|
||||
if (m_lastContacts.contains(key)) {
|
||||
if (!m_typeB && m_lastContacts.contains(key)) {
|
||||
const Contact &prev(m_lastContacts.value(key));
|
||||
if (contact.state == Qt::TouchPointReleased) {
|
||||
// Copy over the previous values for released points, just in case.
|
||||
@ -483,7 +498,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
|
||||
}
|
||||
|
||||
// Avoid reporting a contact in released state more than once.
|
||||
if (contact.state == Qt::TouchPointReleased
|
||||
if (!m_typeB && contact.state == Qt::TouchPointReleased
|
||||
&& !m_lastContacts.contains(key)) {
|
||||
it.remove();
|
||||
continue;
|
||||
@ -509,8 +524,14 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
Contact &contact(it.value());
|
||||
if (contact.state == Qt::TouchPointReleased)
|
||||
it.remove();
|
||||
if (contact.state == Qt::TouchPointReleased) {
|
||||
if (m_typeB)
|
||||
contact.state = static_cast<Qt::TouchPointState>(0);
|
||||
else
|
||||
it.remove();
|
||||
} else {
|
||||
contact.state = Qt::TouchPointStationary;
|
||||
}
|
||||
}
|
||||
|
||||
m_lastContacts = m_contacts;
|
||||
|
Loading…
x
Reference in New Issue
Block a user