Commit 6a16d6c4 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Update this patch so it applies cleanly to 5.12.3

parent 069a657a
From bb58e3fda70d83f696f1183defc93e6501a69c55 Mon Sep 17 00:00:00 2001 diff --git a/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp
From: Dmitry Kazakov <dimula73@gmail.com> index 9a8b5d512..4a8322337 100644
Date: Wed, 15 May 2019 19:39:44 +0300 --- a/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp
Subject: [PATCH 1/2] Fix using tablet on QML widgets +++ b/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp
@@ -639,14 +639,16 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin
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
#endif #endif
} }
...@@ -38,7 +21,7 @@ index 190fb208..07f4d41e 100644 ...@@ -38,7 +21,7 @@ index 190fb208..07f4d41e 100644
} }
bool QWindowsPointerHandler::translateMouseWheelEvent(QWindow *window, 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; Qt::MouseEventSource source = Qt::MouseEventNotSynthesized;
...@@ -47,6 +30,59 @@ index 190fb208..07f4d41e 100644 ...@@ -47,6 +30,59 @@ index 190fb208..07f4d41e 100644
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch) if (QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)
return false; return false;
source = Qt::MouseEventSynthesizedBySystem; source = Qt::MouseEventSynthesizedBySystem;
-- diff --git a/qtbase/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/qtbase/src/plugins/platforms/windows/qwindowstabletsupport.cpp
2.20.1.windows.1 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 =
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment