From e62a8a4709ee5f7279ca157c4219d28f3b708d33 Mon Sep 17 00:00:00 2001 From: fnoily Date: Wed, 4 Jan 2023 16:18:02 +0800 Subject: [PATCH] [PATCH] 1.Del-touch-point-without-target.patch 2.Fix-touch-failure-after-right-click-menu.patch --- src/gui/kernel/qguiapplication.cpp | 3 ++- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index a95331e2..bbdf9cea 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3061,7 +3061,8 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To QEvent::Type mouseEventType = QEvent::MouseMove; Qt::MouseButton button = Qt::NoButton; Qt::MouseButtons buttons = Qt::LeftButton; - if (eventType == QEvent::TouchBegin && m_fakeMouseSourcePointId < 0) + if ((eventType == QEvent::TouchBegin && m_fakeMouseSourcePointId < 0) + || (touchPoints.count() == 1 && m_fakeMouseSourcePointId != touchPoints.first().id())) m_fakeMouseSourcePointId = touchPoints.first().id(); for (const auto &touchPoint : touchPoints) { if (touchPoint.id() == m_fakeMouseSourcePointId) { diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 27a2526d..46746306 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -593,6 +593,10 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y),xiDeviceEvent->event); if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)) xi2ProcessTouch(xiDeviceEvent, platformWindow); + else { // When the window cannot be matched, delete it from touchPoints + if (TouchDeviceData *dev = touchDeviceForId(xiDeviceEvent->sourceid)) + dev->touchPoints.remove((xiDeviceEvent->detail % INT_MAX)); + } break; } } else if (xiEnterEvent && !xi2MouseEventsDisabled() && eventListener) {