Commit d6a265a7 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Update this patch so it applies cleanly to 5.12.3

parent 6a16d6c4
From 5a518a022d840571e6fb6cb1448fc801a2678aba Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Wed, 15 May 2019 19:54:52 +0300
Subject: [PATCH] Add workaround for handling table press correctly in WinInk
mode
Original problem: widgets do not get synthesized mouse-down and
mouse-press events until the stylus is released
Reason: if the app accepts the event, WndProc should report
that to the system (by returning true). This is the only way to
prevent Windows from starting some system-wide gestures, like
click+hold -> right button click. If we ignore the event, then
OS postpones all synthesized mouse events until the entire gesture
is completed.
The patch implements a "hackish" workaround for the original problem
by using the following rules:
1) All tablet-move events are ignored (without synthesized mouse events
OS doesn't generate any Enter/Leave events)
2) All not-accepted tablet press- and release-events and also reported as
ignored (without it D&D doesn't work).
3) All accepted tablet press- and release-events are reported as "accepted",
**but** we artificially synthesize mouse events for them.
TODO: there are still one problem:
1) Perhaps this synthesizeMouseEvent() is not needed at all. But we should
first check if Qt relies on these synthesized messages anywhere in the
code or not.
See bug: https://bugs.kde.org/show_bug.cgi?id=406668
---
src/gui/kernel/qguiapplication.cpp | 1 +
src/gui/kernel/qwindowsysteminterface.cpp | 20 ++---
src/gui/kernel/qwindowsysteminterface.h | 8 +-
.../windows/qwindowspointerhandler.cpp | 88 ++++++++++++++++++-
4 files changed, 99 insertions(+), 18 deletions(-)
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 3541c1ae..681cbd85 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2536,6 +2536,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
diff --git a/qtbase/src/gui/kernel/qguiapplication.cpp b/qtbase/src/gui/kernel/qguiapplication.cpp
index fd01f8bb7..4d61d9fd8 100644
--- a/qtbase/src/gui/kernel/qguiapplication.cpp
+++ b/qtbase/src/gui/kernel/qguiapplication.cpp
@@ -2532,6 +2532,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
tabletEvent.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &tabletEvent);
pointData.state = e->buttons;
......@@ -52,11 +10,11 @@ index 3541c1ae..681cbd85 100644
if (!tabletEvent.isAccepted()
&& !QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse
&& qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTabletEvents)) {
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 0bedae1b..779a9ee4 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -869,7 +869,7 @@ void QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(boo
diff --git a/qtbase/src/gui/kernel/qwindowsysteminterface.cpp b/qtbase/src/gui/kernel/qwindowsysteminterface.cpp
index b0f286912..b3b6167c9 100644
--- a/qtbase/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/qtbase/src/gui/kernel/qwindowsysteminterface.cpp
@@ -949,7 +949,7 @@ void QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(boo
platformSynthesizesMouse = v;
}
......@@ -65,7 +23,7 @@ index 0bedae1b..779a9ee4 100644
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers)
@@ -880,36 +880,36 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp,
@@ -960,36 +960,36 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp,
QHighDpi::fromNativePixels(global, window),
device, pointerType, buttons, pressure,
xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
......@@ -111,11 +69,11 @@ index 0bedae1b..779a9ee4 100644
}
#endif // QT_DEPRECATED_SINCE(5, 10)
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 1dde9130..0ad89547 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -243,20 +243,20 @@ public:
diff --git a/qtbase/src/gui/kernel/qwindowsysteminterface.h b/qtbase/src/gui/kernel/qwindowsysteminterface.h
index bf98c33a1..fdc5a2fb5 100644
--- a/qtbase/src/gui/kernel/qwindowsysteminterface.h
+++ b/qtbase/src/gui/kernel/qwindowsysteminterface.h
@@ -247,20 +247,20 @@ public:
static void handleFileOpenEvent(const QString& fileName);
static void handleFileOpenEvent(const QUrl &url);
......@@ -140,11 +98,11 @@ index 1dde9130..0ad89547 100644
int device, int pointerType, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
index 07f4d41e..e8c98948 100644
--- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp
+++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
@@ -518,6 +518,58 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd,
diff --git a/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp
index 9a8b5d512..93498d58b 100644
--- a/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp
+++ b/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp
@@ -535,6 +535,58 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd,
return false; // Allow mouse messages to be generated.
}
......@@ -203,7 +161,7 @@ index 07f4d41e..e8c98948 100644
bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et,
MSG msg, PVOID vPenInfo)
{
@@ -610,10 +662,38 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin
@@ -622,10 +674,38 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin
}
const Qt::KeyboardModifiers keyModifiers = QWindowsKeyMapper::queryKeyboardModifiers();
......@@ -246,6 +204,3 @@ index 07f4d41e..e8c98948 100644
}
}
return true;
--
2.20.1.windows.1
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