From 33a9b5b4c7945c800b6590b993c841fb833276e8 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 30 Apr 2009 11:33:03 +0200 Subject: Determine whether TouchBegin or TouchEnd should be sent at the time of touchpoint addition/removal This will make it easier to change later when supporting touching multiple widgets --- src/gui/kernel/qapplication_win.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 9b756a6..60bad92 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -4039,7 +4039,8 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg) { Q_Q(QApplication); - bool sendTouchBegin = currentTouchPoints.isEmpty(); + bool sendTouchBegin = false; + bool sendTouchEnd = false; QList activeTouchPoints = currentTouchPoints; QVector winTouchInputs(msg.wParam); @@ -4065,13 +4066,17 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg) bool down = touchPoint->d->state != Qt::TouchPointReleased; QPointF globalPos(qreal(touchInput.x) / qreal(100.), qreal(touchInput.y) / qreal(100.)); if (!down && (touchInput.dwFlags & TOUCHEVENTF_DOWN)) { + sendTouchBegin = currentTouchPoints.isEmpty(); insertActiveTouch(touchPoint); activeTouchPoints = currentTouchPoints; + touchPoint->d->state = Qt::TouchPointPressed; touchPoint->d->globalPos = touchPoint->d->startGlobalPos = touchPoint->d->lastGlobalPos = globalPos; touchPoint->d->pressure = qreal(1.); } else if (down && (touchInput.dwFlags & TOUCHEVENTF_UP)) { removeActiveTouch(touchPoint); + sendTouchEnd = currentTouchPoints.isEmpty(); + touchPoint->d->state = Qt::TouchPointReleased; touchPoint->d->lastGlobalPos = touchPoint->d->globalPos; touchPoint->d->globalPos = globalPos; @@ -4087,8 +4092,6 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg) } QApplicationPrivate::CloseTouchInputHandle((HANDLE) msg.lParam); - bool sendTouchEnd = currentTouchPoints.isEmpty(); - if (activeTouchPoints.isEmpty()) return false; -- cgit v0.12