Commit a3193fe2 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Add a hacky patch that ensures QTabletEvents to be ignored in distribution builds

If we ensure that all the tablet events are ignored, then Qt
will always generate synthesized mouse events, avoiding the
problem of lost Enter/Leave events.

We also mark our own build of Qt about the presence of the fix
(therefore, it doesn't need this hack).
parent 62495eaa
From 6851994441cc48cf48853f009dd620e9cebd551a Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Mon, 11 Mar 2019 16:17:17 +0300
Subject: [PATCH] Poison Qt's headers with a mark about presence of Enter/Leave
patch
---
src/gui/kernel/qevent.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 2b1c6a6..69cafaa 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -242,6 +242,10 @@ protected:
};
#endif
+// a temporary mark to know if the patch has landed to Qt or not
+// https://codereview.qt-project.org/#/c/255384/
+#define QT_HAS_ENTER_LEAVE_PATCH
+
#if QT_CONFIG(tabletevent)
class Q_GUI_EXPORT QTabletEvent : public QInputEvent
{
--
2.7.4
......@@ -63,6 +63,7 @@ elseif (NOT APPLE)
PATCH_COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0010-Fix-tablet-jitter-on-X11.patch
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0011-Add-an-ID-for-recognition-of-UGEE-tablets.patch
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0012-Synthesize-Enter-LeaveEvent-when-QTabletEvent-is-acc.patch
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0013-Poison-Qt-s-headers-with-a-mark-about-presence-of-En.patch
CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -verbose -nomake examples -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtgraphicaleffects -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtandroidextras -skip qtserialport -skip qtdatavis3d -skip qtvirtualkeyboard -skip qtspeech -skip qtsensors -skip qtgamepad -skip qtscxml -skip qtremoteobjects -skip qtxmlpatterns -skip qtnetworkauth -skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtpurchasing -skip qtscxml -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard -qt-xcb
INSTALL_DIR ${EXTPREFIX_qt}
......@@ -166,6 +167,8 @@ else( APPLE )
set(ext_qt_PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/macdeploy-qt.diff
COMMAND ${PATCH_COMMAND} -p1 -b -d <SOURCE_DIR>/qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/mac_standardpaths_qtbug-61159.diff
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0012-Synthesize-Enter-LeaveEvent-when-QTabletEvent-is-acc.patch
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0013-Poison-Qt-s-headers-with-a-mark-about-presence-of-En.patch
#COMMAND ${PATCH_COMMAND} -p1 -b -d <SOURCE_DIR>/qtbase/mkspecs/features/mac -i ${CMAKE_CURRENT_SOURCE_DIR}/mac-default.patch
)
message(STATUS "${EXTPREFIX_qt}:Additional patches injected.")
......
......@@ -496,6 +496,13 @@ bool KisInputManager::eventFilterImpl(QEvent * event)
//Reset signal compressor to prevent processing events before press late
d->resetCompressor();
d->eatOneMousePress();
#if defined Q_OS_LINUX && !defined QT_HAS_ENTER_LEAVE_PATCH
// remove this hack when this patch is integrated:
// https://codereview.qt-project.org/#/c/255384/
event->setAccepted(false);
#endif
break;
}
case QEvent::TabletMove: {
......@@ -517,6 +524,12 @@ bool KisInputManager::eventFilterImpl(QEvent * event)
*/
d->blockMouseEvents();
#if defined Q_OS_LINUX && !defined QT_HAS_ENTER_LEAVE_PATCH
// remove this hack when this patch is integrated:
// https://codereview.qt-project.org/#/c/255384/
event->setAccepted(false);
#endif
break;
}
case QEvent::TabletRelease: {
......@@ -529,6 +542,13 @@ bool KisInputManager::eventFilterImpl(QEvent * event)
retval = d->matcher.buttonReleased(tabletEvent->button(), tabletEvent);
retval = true;
event->setAccepted(true);
#if defined Q_OS_LINUX && !defined QT_HAS_ENTER_LEAVE_PATCH
// remove this hack when this patch is integrated:
// https://codereview.qt-project.org/#/c/255384/
event->setAccepted(false);
#endif
break;
}
......
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