summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-06-24 13:06:00 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-06-24 13:06:00 (GMT)
commitf90d8f3fe7e39a20b93a2ddfe0704bc48f3bd5f9 (patch)
treea7be6f90bb5807edcc2b8a5e273c42ebcd69e7be /src/gui
parent766f95d10813382fd2b9b1b131bd964fd7b71ef9 (diff)
downloadQt-f90d8f3fe7e39a20b93a2ddfe0704bc48f3bd5f9.zip
Qt-f90d8f3fe7e39a20b93a2ddfe0704bc48f3bd5f9.tar.gz
Qt-f90d8f3fe7e39a20b93a2ddfe0704bc48f3bd5f9.tar.bz2
Multi-touch, Cocoa: Make sure that touch points are ordered.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qmultitouch_mac.mm14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/kernel/qmultitouch_mac.mm b/src/gui/kernel/qmultitouch_mac.mm
index d9cb8b6..cae3672 100644
--- a/src/gui/kernel/qmultitouch_mac.mm
+++ b/src/gui/kernel/qmultitouch_mac.mm
@@ -132,7 +132,7 @@ Qt::TouchPointState QCocoaTouch::toTouchPointState(NSTouchPhase nsState)
QList<QTouchEvent::TouchPoint>
QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
{
- QList<QTouchEvent::TouchPoint> touchPoints;
+ QMap<int, QTouchEvent::TouchPoint> touchPoints;
NSSet *ended = [event touchesMatchingPhase:NSTouchPhaseEnded | NSTouchPhaseCancelled inView:nil];
NSSet *active = [event
touchesMatchingPhase:NSTouchPhaseBegan | NSTouchPhaseMoved | NSTouchPhaseStationary
@@ -150,7 +150,7 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
if (qcocoaTouch) {
qcocoaTouch->updateTouchData(touch, [touch phase]);
if (!_updateInternalStateOnly)
- touchPoints.append(qcocoaTouch->_touchPoint);
+ touchPoints.insert(qcocoaTouch->_touchPoint.id(), qcocoaTouch->_touchPoint);
delete qcocoaTouch;
}
}
@@ -170,7 +170,7 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
else
qcocoaTouch->updateTouchData(touch, wasUpdateInternalStateOnly ? NSTouchPhaseBegan : [touch phase]);
if (!_updateInternalStateOnly)
- touchPoints.append(qcocoaTouch->_touchPoint);
+ touchPoints.insert(qcocoaTouch->_touchPoint.id(), qcocoaTouch->_touchPoint);
}
// Next: sadly, we need to check that our touch hash is in
@@ -184,13 +184,13 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
foreach (QCocoaTouch *qcocoaTouch, _currentTouches.values()) {
if (!_updateInternalStateOnly) {
qcocoaTouch->_touchPoint.setState(Qt::TouchPointReleased);
- touchPoints.append(qcocoaTouch->_touchPoint);
+ touchPoints.insert(qcocoaTouch->_touchPoint.id(), qcocoaTouch->_touchPoint);
}
delete qcocoaTouch;
}
_currentTouches.clear();
_updateInternalStateOnly = !acceptSingleTouch;
- return touchPoints;
+ return touchPoints.values();
}
// Finally: If this call _started_ to reject single
@@ -200,7 +200,7 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
if (_updateInternalStateOnly && !wasUpdateInternalStateOnly && !_currentTouches.isEmpty()) {
QCocoaTouch *qcocoaTouch = _currentTouches.values().first();
qcocoaTouch->_touchPoint.setState(Qt::TouchPointReleased);
- touchPoints.append(qcocoaTouch->_touchPoint);
+ touchPoints.insert(qcocoaTouch->_touchPoint.id(), qcocoaTouch->_touchPoint);
// Since this last touch also will end up beeing the first
// touch (if the user adds a second finger without lifting
// the first), we promote it to be the primary touch:
@@ -208,7 +208,7 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
_idAssignmentCount = 1;
}
- return touchPoints;
+ return touchPoints.values();
}
#endif