diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-11-30 19:19:27 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-12 12:28:29 +0100 |
commit | 6f1c4fb342dd94b21df8f5c2bbdfa4b9f5a09c4e (patch) | |
tree | 7d1caeed412eb527cf12e68ecde2b992c4678113 /src/plugins/platforms | |
parent | 67be01ae5048138e894fa8d3eb0abe93c5699048 (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/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qmultitouch_mac.mm | 3 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsmousehandler.cpp | 5 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_maemo.cpp | 3 |
3 files changed, 7 insertions, 4 deletions
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; } |