From c400e57c82e32d55cec0bb65465e9297927cc01e Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 21 May 2010 12:38:20 +0200 Subject: Backport multitouch bug fixes to 4.6 commit 24b811e53b30546279346ab7b16799be119ab8c4 on 4.7 includes bug fixes which are needed for 4.6 as well. 1. TouchEnd event was missing 2. pressure in touchpoints was set to 0.0 for non pressure sensitive touch screens, it should be set to 1.0 for consistency with existing Qt ports (e.g. mac). Task-number: QTBUG-10885 Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qapplication_p.h | 3 ++- src/gui/kernel/qapplication_s60.cpp | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index ce39334..cf144c5 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -566,7 +566,8 @@ public: void _q_readRX71MultiTouchEvents(); #endif -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) + int pressureSupported; int maxTouchPressure; QList appAllTouchPoints; #endif diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index dbdcef9..6e6a806 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -407,15 +407,22 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent *event) { QApplicationPrivate *d = QApplicationPrivate::instance(); + qreal pressure; + if(d->pressureSupported + && event->Pressure() > 0) //workaround for misconfigured HAL + pressure = event->Pressure() / qreal(d->maxTouchPressure); + else + pressure = qreal(1.0); QRect screenGeometry = qApp->desktop()->screenGeometry(qwidget); - while (d->appAllTouchPoints.count() <= event->PointerNumber()) - d->appAllTouchPoints.append(QTouchEvent::TouchPoint(d->appAllTouchPoints.count())); + QList points = d->appAllTouchPoints; + while (points.count() <= event->PointerNumber()) + points.append(QTouchEvent::TouchPoint(points.count())); Qt::TouchPointStates allStates = 0; - for (int i = 0; i < d->appAllTouchPoints.count(); ++i) { - QTouchEvent::TouchPoint &touchPoint = d->appAllTouchPoints[i]; + for (int i = 0; i < points.count(); ++i) { + QTouchEvent::TouchPoint &touchPoint = points[i]; if (touchPoint.id() == event->PointerNumber()) { Qt::TouchPointStates state; @@ -445,7 +452,7 @@ void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(), screenPos.y() / screenGeometry.height())); - touchPoint.setPressure(event->Pressure() / qreal(d->maxTouchPressure)); + touchPoint.setPressure(pressure); } else if (touchPoint.state() != Qt::TouchPointReleased) { // all other active touch points should be marked as stationary touchPoint.setState(Qt::TouchPointStationary); @@ -457,11 +464,13 @@ void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased) { // all touch points released d->appAllTouchPoints.clear(); + } else { + d->appAllTouchPoints = points; } QApplicationPrivate::translateRawTouchEvent(qwidget, QTouchEvent::TouchScreen, - d->appAllTouchPoints); + points); } #endif @@ -1916,6 +1925,8 @@ TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym) void QApplicationPrivate::initializeMultitouch_sys() { #ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER + if (HAL::Get(HALData::EPointer3DPressureSupported, pressureSupported) != KErrNone) + pressureSupported = 0; if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone) maxTouchPressure = KMaxTInt; #endif -- cgit v0.12