diff options
Diffstat (limited to 'src/plugins')
5 files changed, 15 insertions, 11 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(); } } diff --git a/src/plugins/platforms/cocoa/qmultitouch_mac.mm b/src/plugins/platforms/cocoa/qmultitouch_mac.mm index 855bfc2a06..f680f022ae 100644 --- a/src/plugins/platforms/cocoa/qmultitouch_mac.mm +++ b/src/plugins/platforms/cocoa/qmultitouch_mac.mm @@ -73,7 +73,8 @@ QCocoaTouch::~QCocoaTouch() void QCocoaTouch::updateTouchData(NSTouch *nstouch, NSTouchPhase phase) { _touchPoint.state = toTouchPointState(phase); - _touchPoint.isPrimary = (_touchCount == 1); + if (_touchCount == 1) + _touchPoint.flags |= QTouchEvent::TouchPoint::Primary; // From the normalized position on the trackpad, calculate // where on screen the touchpoint should be according to the diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 608230e6e0..79422be005 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -240,7 +240,8 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, const TOUCHINPUT &winTouchInput = winTouchInputs[i]; QTouchPoint touchPoint; touchPoint.pressure = 1.0; - touchPoint.isPrimary = (winTouchInput.dwFlags & TOUCHEVENTF_PRIMARY) != 0; + if ((winTouchInput.dwFlags & TOUCHEVENTF_PRIMARY) != 0) + touchPoint.flags |= QTouchEvent::TouchPoint::Primary; touchPoint.id = m_touchInputIDToTouchPointID.value(winTouchInput.dwID, -1); if (touchPoint.id == -1) { touchPoint.id = m_touchInputIDToTouchPointID.size(); @@ -275,7 +276,7 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, QWindowsContext::user32dll.closeTouchInputHandle((HANDLE) msg.lParam); // all touch points released, forget the ids we've seen, they may not be reused - if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased) + if (allStates == Qt::TouchPointReleased) m_touchInputIDToTouchPointID.clear(); if (!m_touchDevice) { diff --git a/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp b/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp index 23421e59d2..39195b9aab 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_maemo.cpp @@ -222,7 +222,8 @@ void QXcbConnection::handleGenericEvent(xcb_ge_event_t *event) for (int i = 0; i < m_xinputData->xiMaxContacts; ++i) { QWindowSystemInterface::TouchPoint tp; tp.id = i; - tp.isPrimary = (i == 0); + if (i == 0) + tp.flags |= QTouchEvent::TouchPoint::Primary; tp.state = Qt::TouchPointReleased; touchPoints << tp; } |