summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-19 12:20:53 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-19 12:20:53 (GMT)
commit072dd3efbe278fca0253a3e8d0e3cb52320b7a5b (patch)
treeb3b19c888f085f827925a481c3d1d8e5278acd3d /src/gui
parent46467bcaab29c40a4a3465232b5368d8cda75502 (diff)
downloadQt-072dd3efbe278fca0253a3e8d0e3cb52320b7a5b.zip
Qt-072dd3efbe278fca0253a3e8d0e3cb52320b7a5b.tar.gz
Qt-072dd3efbe278fca0253a3e8d0e3cb52320b7a5b.tar.bz2
Handle the case where TOUCHINPUT id numbers are not reused
As documented in the Windows 7 SDK RC, the id's may not be reused. We don't want the touchInputIDToTouchPointID hash to grow indefinitely, so clear it each time we detect that all touch points have been released.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication_win.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 66dfee2..f8b1cbb 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -4027,6 +4027,7 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg)
QVector<TOUCHINPUT> winTouchInputs(msg.wParam);
memset(winTouchInputs.data(), 0, sizeof(TOUCHINPUT) * winTouchInputs.count());
+ Qt::TouchPointStates allStates = 0;
QApplicationPrivate::GetTouchInputInfo((HANDLE) msg.lParam, msg.wParam, winTouchInputs.data(), sizeof(TOUCHINPUT));
for (int i = 0; i < winTouchInputs.count(); ++i) {
const TOUCHINPUT &touchInput = winTouchInputs.at(i);
@@ -4062,10 +4063,17 @@ bool QApplicationPrivate::translateTouchEvent(const MSG &msg)
touchPoint.setState(state);
touchPoint.setScreenRect(screenRect);
+ allStates |= state;
+
touchPoints.append(touchPoint);
}
QApplicationPrivate::CloseTouchInputHandle((HANDLE) msg.lParam);
+ if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased) {
+ // all touch points released, forget the ids we've seen, they may not be reused
+ touchInputIDToTouchPointID.clear();
+ }
+
translateRawTouchEvent(widgetForHwnd, touchPoints);
return true;
}