From bc997b856aa7b0b2137b568cd3fc6f190cd89f84 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Wed, 12 Dec 2018 15:42:40 +0100 Subject: Windows QPA: Fix touch message queue handling In the handling of pointer messages for touchscreen we use a queue that is flushed when mouse messages synthesized by Windows are received. However, these fake mouse messages should be otherwise ignored. Their handling was causing issues with PointHandler in QtQuick. This change fixes the part of QTBUG-71431 that causes a single touch drag to behave unexpectedly with PointHandler. Task-number: QTBUG-71431 Change-Id: Iccdd554876f411bce2dd1f922a3d889e61b7bb1c Reviewed-by: Miguel Costa --- src/plugins/platforms/windows/qwindowspointerhandler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/plugins/platforms/windows/qwindowspointerhandler.cpp') diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index 7935d0c36f..3534f06971 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -641,6 +641,7 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd, // Only the primary pointer will generate mouse messages. enqueueTouchEvent(window, touchPoints, QWindowsKeyMapper::queryKeyboardModifiers()); } else { + flushTouchEvents(m_touchDevice); QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, touchPoints, QWindowsKeyMapper::queryKeyboardModifiers()); } @@ -766,6 +767,13 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window, HWND hwnd, QtW if (et != QtWindows::MouseWheelEvent && msg.message != WM_MOUSELEAVE && msg.message != WM_MOUSEMOVE) return false; + // Ignore messages synthesized from touch/pen (only use them for flushing queues). + const quint64 signatureMask = 0xffffff00; + const quint64 miWpSignature = 0xff515700; + const quint64 extraInfo = quint64(GetMessageExtraInfo()); + if ((extraInfo & signatureMask) == miWpSignature) + return false; + const QPoint eventPos(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); QPoint localPos; QPoint globalPos; -- cgit v1.2.3