summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@jollamobile.com>2014-01-22 12:26:10 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 18:53:29 +0100
commit6c017d0a2b3930ef87d4fb5c533c8d9c8f7bb15c (patch)
tree8f76450dbb751b9af311abd59885b49eeb5eb309 /src
parent8cf9811ec378b9903e3f64d027f625d9ab0ac7db (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouch.cpp37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
index d9468ae1b8..81746974c5 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
@@ -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;