From 6a16d6c4ea9853c90af663a59ff13e0eae2bb2dd Mon Sep 17 00:00:00 2001 From: Boudewijn Rempt Date: Tue, 4 Jun 2019 13:34:55 +0200 Subject: [PATCH] Update this patch so it applies cleanly to 5.12.3 --- ...0050-Fix-using-tablet-on-QML-widgets.patch | 88 +++++++++++++------ 1 file changed, 62 insertions(+), 26 deletions(-) diff --git a/3rdparty/ext_qt/0050-Fix-using-tablet-on-QML-widgets.patch b/3rdparty/ext_qt/0050-Fix-using-tablet-on-QML-widgets.patch index 8b79e1f5dd..37ad773316 100644 --- a/3rdparty/ext_qt/0050-Fix-using-tablet-on-QML-widgets.patch +++ b/3rdparty/ext_qt/0050-Fix-using-tablet-on-QML-widgets.patch @@ -1,25 +1,8 @@ -From bb58e3fda70d83f696f1183defc93e6501a69c55 Mon Sep 17 00:00:00 2001 -From: Dmitry Kazakov -Date: Wed, 15 May 2019 19:39:44 +0300 -Subject: [PATCH 1/2] Fix using tablet on QML widgets - -In previous versions of Qt (wintab impeplementation) the events were -marked by Qt::MouseEventSynthesizedBySystem flag only when they were -synthesized from touch, not from tablet events. This is what -QWindowsTabletSupport does and what QQuickWindow expects (it -filters out all synthesized events). This patch recovers the old behavior -for the new QWindowsPointerHandler tablet API implementation. - -See bug: https://bugs.kde.org/show_bug.cgi?id=406668 ---- - src/plugins/platforms/windows/qwindowspointerhandler.cpp | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp -index 190fb208..07f4d41e 100644 ---- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp -+++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp -@@ -627,14 +627,16 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin +diff --git a/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp +index 9a8b5d512..4a8322337 100644 +--- a/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp ++++ b/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp +@@ -639,14 +639,16 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin #endif } @@ -38,7 +21,7 @@ index 190fb208..07f4d41e 100644 } bool QWindowsPointerHandler::translateMouseWheelEvent(QWindow *window, -@@ -705,7 +707,7 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window, +@@ -716,7 +718,7 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window, } Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; @@ -47,6 +30,59 @@ index 190fb208..07f4d41e 100644 if (QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch) return false; source = Qt::MouseEventSynthesizedBySystem; --- -2.20.1.windows.1 - +diff --git a/qtbase/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/qtbase/src/plugins/platforms/windows/qwindowstabletsupport.cpp +index fa209f09c..462be8b3f 100644 +--- a/qtbase/src/plugins/platforms/windows/qwindowstabletsupport.cpp ++++ b/qtbase/src/plugins/platforms/windows/qwindowstabletsupport.cpp +@@ -434,6 +434,14 @@ bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, L + if (m_currentDevice < 0) { + m_currentDevice = m_devices.size(); + m_devices.push_back(tabletInit(uniqueId, cursorType)); ++ } else { ++ /** ++ * The user can switch pressure sensitivity level in the driver, ++ * which will make our saved values invalid (this option is ++ * provided by Wacom drivers for compatibility reasons, and ++ * it can be adjusted on the fly) ++ */ ++ m_devices[m_currentDevice] = tabletInit(uniqueId, cursorType); + } + m_devices[m_currentDevice].currentPointerType = pointerType(currentCursor); + m_state = PenProximity; +@@ -454,7 +462,6 @@ bool QWindowsTabletSupport::translateTabletPacketEvent() + return false; + + const int currentDevice = m_devices.at(m_currentDevice).currentDevice; +- const int currentPointer = m_devices.at(m_currentDevice).currentPointerType; + const qint64 uniqueId = m_devices.at(m_currentDevice).uniqueId; + + // The tablet can be used in 2 different modes (reflected in enum Mode), +@@ -484,6 +491,28 @@ bool QWindowsTabletSupport::translateTabletPacketEvent() + for (int i = 0; i < packetCount ; ++i) { + const PACKET &packet = localPacketBuf[i]; + ++ int currentPointer = m_devices.at(m_currentDevice).currentPointerType; ++ ++ const int packetPointerType = pointerType(packet.pkCursor); ++ if (!packet.pkButtons && packetPointerType != currentPointer) { ++ ++ QWindowSystemInterface::handleTabletLeaveProximityEvent(packet.pkTime, ++ m_devices.at(m_currentDevice).currentDevice, ++ m_devices.at(m_currentDevice).currentPointerType, ++ m_devices.at(m_currentDevice).uniqueId); ++ ++ ++ ++ m_devices[m_currentDevice].currentPointerType = packetPointerType; ++ ++ QWindowSystemInterface::handleTabletEnterProximityEvent(packet.pkTime, ++ m_devices.at(m_currentDevice).currentDevice, ++ m_devices.at(m_currentDevice).currentPointerType, ++ m_devices.at(m_currentDevice).uniqueId); ++ ++ currentPointer = packetPointerType; ++ } ++ + const int z = currentDevice == QTabletEvent::FourDMouse ? int(packet.pkZ) : 0; + + QPointF globalPosF = -- 2.24.0