2019-06-28 16:32:03 +02:00
|
|
|
From 34db59a076dd824401f952b305a4f575b0140f79 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Dmitry Kazakov <dimula73@gmail.com>
|
|
|
|
Date: Mon, 11 Mar 2019 13:18:06 +0300
|
|
|
|
Subject: [PATCH 2/3] Synthesize Enter/LeaveEvent for accepted QTabletEvent
|
|
|
|
|
|
|
|
When the tablet event is accepted, then Qt doesn't synthesize a mouse
|
|
|
|
event, it means that QApplicationPrivate::sendMouseEvent() will not be
|
|
|
|
called, and, therefore, enter/leave events will not be dispatched.
|
|
|
|
|
|
|
|
The patch looks a bit hackish. Ideally, the synthesize should happen
|
|
|
|
in QGuiApplicationPrivate::processTabletEvent(), which takes the decision
|
|
|
|
about synthesizing mouse events. But there is not enough information
|
|
|
|
on this level: neither qt_last_mouse_receiver nor the receiver widget
|
|
|
|
are known at this stage.
|
|
|
|
|
|
|
|
On Windows and other platforms where there is a parallel stream of
|
|
|
|
mouse events synthesized by the platform, we shouldn't generate these
|
|
|
|
events manually.
|
|
|
|
|
|
|
|
Change-Id: Ifbad6284483ee282ad129db54606f5d0d9ddd633
|
|
|
|
---
|
|
|
|
src/widgets/kernel/qwidgetwindow.cpp | 12 ++++++++++++
|
|
|
|
1 file changed, 12 insertions(+)
|
|
|
|
|
2020-02-26 13:43:12 +01:00
|
|
|
Index: qtbase-everywhere-src-5.15.0-alpha/src/widgets/kernel/qwidgetwindow.cpp
|
|
|
|
===================================================================
|
|
|
|
--- qtbase-everywhere-src-5.15.0-alpha.orig/src/widgets/kernel/qwidgetwindow.cpp
|
|
|
|
+++ qtbase-everywhere-src-5.15.0-alpha/src/widgets/kernel/qwidgetwindow.cpp
|
|
|
|
@@ -1075,6 +1075,18 @@ void QWidgetWindow::handleTabletEvent(QT
|
2019-06-28 16:32:03 +02:00
|
|
|
event->setAccepted(ev.isAccepted());
|
|
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Synthesize Enter/Leave events if it is requested by the system and user
|
|
|
|
+ */
|
|
|
|
+ if (widget != qt_last_mouse_receiver &&
|
|
|
|
+ event->isAccepted() &&
|
|
|
|
+ !QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse &&
|
|
|
|
+ qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTabletEvents)) {
|
|
|
|
+
|
|
|
|
+ QApplicationPrivate::dispatchEnterLeave(widget, qt_last_mouse_receiver, event->globalPos());
|
|
|
|
+ qt_last_mouse_receiver = widget;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (event->type() == QEvent::TabletRelease && event->buttons() == Qt::NoButton)
|
2020-02-26 13:43:12 +01:00
|
|
|
qt_tablet_target = nullptr;
|
2019-06-28 16:32:03 +02:00
|
|
|
}
|