summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-05-21 10:38:20 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-05-21 11:28:17 (GMT)
commitc400e57c82e32d55cec0bb65465e9297927cc01e (patch)
tree3ce4b091c71e3973070386beda78e30abd1c9b56 /src/gui/kernel
parentddcdae43cf00b49522418c2ae65022de14186ef7 (diff)
downloadQt-c400e57c82e32d55cec0bb65465e9297927cc01e.zip
Qt-c400e57c82e32d55cec0bb65465e9297927cc01e.tar.gz
Qt-c400e57c82e32d55cec0bb65465e9297927cc01e.tar.bz2
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
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qapplication_p.h3
-rw-r--r--src/gui/kernel/qapplication_s60.cpp23
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<QTouchEvent::TouchPoint> 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<QTouchEvent::TouchPoint> 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