summaryrefslogtreecommitdiffstats
path: root/src/plugins/generic
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-11-30 19:19:27 +0200
committerQt by Nokia <qt-info@nokia.com>2011-12-12 12:28:29 +0100
commit6f1c4fb342dd94b21df8f5c2bbdfa4b9f5a09c4e (patch)
tree7d1caeed412eb527cf12e68ecde2b992c4678113 /src/plugins/generic
parent67be01ae5048138e894fa8d3eb0abe93c5699048 (diff)
Store the primary status in the touch point flags.
For some reason the primary bit has previously been encoded in the touch point state, even though it has nothing to do with the regular states like Pressed, Released, etc. The value is now stored in the recently introduced flags member of the touch points. This also reduces the need for error-prone internal masking of the state value. The structure used by QWindowSystemInterface::handleTouchEvent also becomes cleaner because the primary status can now be set in the flags member and the isPrimary bool can be dropped. Change-Id: I1da2cb99154afd97e1e3a5943ab115cae3a8232f Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/generic')
-rw-r--r--src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp2
-rw-r--r--src/plugins/generic/touchscreen/qtouchscreen.cpp13
2 files changed, 8 insertions, 7 deletions
diff --git a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
index f8dc84373d..a62f9360c7 100644
--- a/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
+++ b/src/plugins/generic/touchscreen/qtoucheventsenderqpa.cpp
@@ -102,7 +102,7 @@ void QTouchEventSenderQPA::touch_point(const QList<QWindowSystemInterface::Touch
tp.area = QRect(wx, wy, tp.area.width() * sizeRatio, tp.area.height() * sizeRatio);
#ifdef POINT_DEBUG
- qDebug() << " " << i << tp.area << tp.state << tp.id << tp.isPrimary << tp.pressure;
+ qDebug() << " " << i << tp.area << tp.state << tp.id << tp.flags << tp.pressure;
#endif
}
diff --git a/src/plugins/generic/touchscreen/qtouchscreen.cpp b/src/plugins/generic/touchscreen/qtouchscreen.cpp
index fd73bffd4f..1142d0bf0b 100644
--- a/src/plugins/generic/touchscreen/qtouchscreen.cpp
+++ b/src/plugins/generic/touchscreen/qtouchscreen.cpp
@@ -72,8 +72,8 @@ public:
int y;
int maj;
Qt::TouchPointState state;
- bool primary;
- Contact() : trackingId(0), x(0), y(0), maj(1), state(Qt::TouchPointPressed), primary(false) { }
+ QTouchEvent::TouchPoint::InfoFlags flags;
+ Contact() : trackingId(0), x(0), y(0), maj(1), state(Qt::TouchPointPressed), flags(0) { }
};
QMap<int, Contact> m_contacts, m_lastContacts;
Contact m_currentData;
@@ -219,7 +219,8 @@ void QTouchScreenData::processInputEvent(input_event *data)
m_currentData.y = data->value;
} else if (data->code == ABS_MT_TRACKING_ID) {
m_currentData.trackingId = data->value;
- m_currentData.primary = m_contacts.isEmpty();
+ if (m_contacts.isEmpty())
+ m_currentData.flags |= QTouchEvent::TouchPoint::Primary;
} else if (data->code == ABS_MT_TOUCH_MAJOR) {
m_currentData.maj = data->value;
if (data->value == 0)
@@ -238,7 +239,7 @@ void QTouchScreenData::processInputEvent(input_event *data)
it != ite; ++it) {
QWindowSystemInterface::TouchPoint tp;
tp.id = it->trackingId;
- tp.isPrimary = it->primary;
+ tp.flags = it->flags;
tp.pressure = it->state == Qt::TouchPointReleased ? 0 : 1;
if (m_lastContacts.contains(it->trackingId)) {
@@ -323,7 +324,7 @@ void QTouchScreenData::dump()
qDebug() << "touch event" << eventType;
foreach (const QWindowSystemInterface::TouchPoint &tp, m_touchPoints) {
const char *pointState;
- switch (tp.state & Qt::TouchPointStateMask) {
+ switch (tp.state) {
case Qt::TouchPointPressed:
pointState = "pressed";
break;
@@ -341,7 +342,7 @@ void QTouchScreenData::dump()
break;
}
qDebug() << " " << tp.id << tp.area << pointState << tp.normalPosition
- << tp.pressure << tp.isPrimary << tp.area.center();
+ << tp.pressure << tp.flags << tp.area.center();
}
}