diff options
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qmultitouch_mac.mm | 11 | ||||
-rw-r--r-- | src/gui/kernel/qmultitouch_mac_p.h | 1 | ||||
-rw-r--r-- | tests/auto/qtouchevent/tst_qtouchevent.cpp | 6 |
4 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 0b01b73869..54e377e606 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5377,7 +5377,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, touchPoint.setStartNormalizedPos(previousTouchPoint.startNormalizedPos()); touchPoint.setLastNormalizedPos(previousTouchPoint.normalizedPos()); if (touchPoint.pressure() < qreal(0.)) - touchPoint.setPressure(qreal(0.)); + touchPoint.setPressure(qreal(1.)); d->appCurrentTouchPoints[touchPoint.id()] = touchPoint; break; } diff --git a/src/gui/kernel/qmultitouch_mac.mm b/src/gui/kernel/qmultitouch_mac.mm index d3d423cab2..d9cb8b63b5 100644 --- a/src/gui/kernel/qmultitouch_mac.mm +++ b/src/gui/kernel/qmultitouch_mac.mm @@ -83,17 +83,18 @@ void QCocoaTouch::updateTouchData(NSTouch *nstouch, NSTouchPhase phase) // where on screen the touchpoint should be according to the // reference position: NSPoint npos = [nstouch normalizedPosition]; - _trackpadPos = QPointF(npos.x, npos.y); + QPointF qnpos = QPointF(npos.x, 1 - npos.y); + _touchPoint.setNormalizedPos(qnpos); if (_touchPoint.id() == 0 && phase == NSTouchPhaseBegan) { - _trackpadReferencePos = _trackpadPos; + _trackpadReferencePos = qnpos; _screenReferencePos = QCursor::pos(); } NSSize dsize = [nstouch deviceSize]; - float ppiX = (_trackpadPos.x() - _trackpadReferencePos.x()) * dsize.width; - float ppiY = (_trackpadPos.y() - _trackpadReferencePos.y()) * dsize.height; - QPointF relativePos = _trackpadReferencePos - QPointF(ppiX, 1 - ppiY); + float ppiX = (qnpos.x() - _trackpadReferencePos.x()) * dsize.width; + float ppiY = (qnpos.y() - _trackpadReferencePos.y()) * dsize.height; + QPointF relativePos = _trackpadReferencePos - QPointF(ppiX, ppiY); _touchPoint.setScreenPos(_screenReferencePos - relativePos); } diff --git a/src/gui/kernel/qmultitouch_mac_p.h b/src/gui/kernel/qmultitouch_mac_p.h index 0c45df446c..19d72331a5 100644 --- a/src/gui/kernel/qmultitouch_mac_p.h +++ b/src/gui/kernel/qmultitouch_mac_p.h @@ -82,7 +82,6 @@ class QCocoaTouch static bool _updateInternalStateOnly; QTouchEvent::TouchPoint _touchPoint; - QPointF _trackpadPos; int _identity; QCocoaTouch(NSTouch *nstouch); diff --git a/tests/auto/qtouchevent/tst_qtouchevent.cpp b/tests/auto/qtouchevent/tst_qtouchevent.cpp index dee059b3fb..518eb0f719 100644 --- a/tests/auto/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/qtouchevent/tst_qtouchevent.cpp @@ -293,7 +293,7 @@ void tst_QTouchEvent::basicRawEventTranslation() QCOMPARE(touchBeginPoint.rect(), QRectF(pos, QSizeF(0, 0))); QCOMPARE(touchBeginPoint.screenRect(), QRectF(rawTouchPoint.screenPos(), QSizeF(0, 0))); QCOMPARE(touchBeginPoint.sceneRect(), touchBeginPoint.screenRect()); - QCOMPARE(touchBeginPoint.pressure(), qreal(-1.)); + QCOMPARE(touchBeginPoint.pressure(), qreal(1.)); // moving the point should translate to TouchUpdate rawTouchPoint.setState(Qt::TouchPointMoved); @@ -325,7 +325,7 @@ void tst_QTouchEvent::basicRawEventTranslation() QCOMPARE(touchUpdatePoint.rect(), QRectF(pos + delta, QSizeF(0, 0))); QCOMPARE(touchUpdatePoint.screenRect(), QRectF(rawTouchPoint.screenPos(), QSizeF(0, 0))); QCOMPARE(touchUpdatePoint.sceneRect(), touchUpdatePoint.screenRect()); - QCOMPARE(touchUpdatePoint.pressure(), qreal(-1.)); + QCOMPARE(touchUpdatePoint.pressure(), qreal(1.)); // releasing the point translates to TouchEnd rawTouchPoint.setState(Qt::TouchPointReleased); @@ -357,7 +357,7 @@ void tst_QTouchEvent::basicRawEventTranslation() QCOMPARE(touchEndPoint.rect(), QRectF(pos + delta + delta, QSizeF(0, 0))); QCOMPARE(touchEndPoint.screenRect(), QRectF(rawTouchPoint.screenPos(), QSizeF(0, 0))); QCOMPARE(touchEndPoint.sceneRect(), touchEndPoint.screenRect()); - QCOMPARE(touchEndPoint.pressure(), qreal(-1.)); + QCOMPARE(touchEndPoint.pressure(), qreal(0.)); } void tst_QTouchEvent::multiPointRawEventTranslation() |