Windows QPA: Fix onPressedChanged only reported on touch up

This issue was caused by the workaround added to fix QTBUG-70887.
Certain events like the initial touch down do not generate mouse
messages after the pointer messages (but only touch messages) and
should not be postponed by the pointer handler.

Fixes: QTBUG-71775
Change-Id: I7b64ae4d422f6a4c1bb465ce5f8255e85640dab1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Andre de la Rocha 2018-11-15 17:19:23 +01:00 committed by Jani Heikkinen
parent 900b57ea90
commit 8e8c11f4f3

View File

@ -564,6 +564,7 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd,
QList<QWindowSystemInterface::TouchPoint> touchPoints;
bool primaryPointer = false;
bool pressRelease = false;
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaEvents).noquote().nospace() << showbase
@ -600,9 +601,11 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd,
if (touchInfo[i].pointerInfo.pointerFlags & POINTER_FLAG_DOWN) {
touchPoint.state = Qt::TouchPointPressed;
m_lastTouchPositions.insert(touchPoint.id, touchPoint.normalPosition);
pressRelease = true;
} else if (touchInfo[i].pointerInfo.pointerFlags & POINTER_FLAG_UP) {
touchPoint.state = Qt::TouchPointReleased;
m_lastTouchPositions.remove(touchPoint.id);
pressRelease = true;
} else {
touchPoint.state = stationaryTouchPoint ? Qt::TouchPointStationary : Qt::TouchPointMoved;
m_lastTouchPositions.insert(touchPoint.id, touchPoint.normalPosition);
@ -615,7 +618,7 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd,
// Avoid getting repeated messages for this frame if there are multiple pointerIds
QWindowsContext::user32dll.skipPointerFrameMessages(touchInfo[i].pointerInfo.pointerId);
}
if (primaryPointer) {
if (primaryPointer && !pressRelease) {
// Postpone event delivery to avoid hanging inside DoDragDrop().
// Only the primary pointer will generate mouse messages.
enqueueTouchEvent(window, touchPoints, QWindowsKeyMapper::queryKeyboardModifiers());