Warning, /graphics/krita/3rdparty/ext_qt/0020-Synthesize-Enter-LeaveEvent-for-accepted-QTabletEven.patch is written in an unsupported language. File is not indexed.
0001 From 96d92d83b4dc6ad201da82266d5e1edfb734bb90 Mon Sep 17 00:00:00 2001 0002 From: Dmitry Kazakov <dimula73@gmail.com> 0003 Date: Mon, 11 Mar 2019 13:18:06 +0300 0004 Subject: [PATCH 03/47] Synthesize Enter/LeaveEvent for accepted QTabletEvent 0005 0006 When the tablet event is accepted, then Qt doesn't synthesize a mouse 0007 event, it means that QApplicationPrivate::sendMouseEvent() will not be 0008 called, and, therefore, enter/leave events will not be dispatched. 0009 0010 The patch looks a bit hackish. Ideally, the synthesize should happen 0011 in QGuiApplicationPrivate::processTabletEvent(), which takes the decision 0012 about synthesizing mouse events. But there is not enough information 0013 on this level: neither qt_last_mouse_receiver nor the receiver widget 0014 are known at this stage. 0015 0016 On Windows and other platforms where there is a parallel stream of 0017 mouse events synthesized by the platform, we shouldn't generate these 0018 events manually. 0019 0020 Change-Id: Ifbad6284483ee282ad129db54606f5d0d9ddd633 0021 --- 0022 src/widgets/kernel/qwidgetwindow.cpp | 12 ++++++++++++ 0023 1 file changed, 12 insertions(+) 0024 0025 diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp 0026 index e74243203a..7f1db99f60 100644 0027 --- a/src/widgets/kernel/qwidgetwindow.cpp 0028 +++ b/src/widgets/kernel/qwidgetwindow.cpp 0029 @@ -1063,6 +1063,18 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event) 0030 event->setAccepted(ev.isAccepted()); 0031 } 0032 0033 + /** 0034 + * Synthesize Enter/Leave events if it is requested by the system and user 0035 + */ 0036 + if (widget != qt_last_mouse_receiver && 0037 + event->isAccepted() && 0038 + !QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse && 0039 + qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTabletEvents)) { 0040 + 0041 + QApplicationPrivate::dispatchEnterLeave(widget, qt_last_mouse_receiver, event->globalPos()); 0042 + qt_last_mouse_receiver = widget; 0043 + } 0044 + 0045 if (event->type() == QEvent::TabletRelease && event->buttons() == Qt::NoButton) 0046 qt_tablet_target = 0; 0047 } 0048 -- 0049 2.20.1.windows.1 0050