From 663fe761a88473ca1fae1f7f3662d3cabfcff1e5 Mon Sep 17 00:00:00 2001 From: Markus Macsek Date: Wed, 5 Jun 2019 21:02:04 +0200 Subject: [PATCH] qguiapplication: processTouchEvent: fix handling of blocking modal window It is not enough to just inform the QGuiApplication about a touch cancel. This is due to the interchangeable handling of touch and mouse events in QT. Thus, in the case of a touch cancel also the mouse state needs to be informed. Otherwise, the very fist touch begin is interpreted as a mouse move instead of a mouse press, i. e. the corresponding mouse click is lost. Fortunately, the right handling of a touch cancel is already implemented at the top of the very same function. So all we need is to make a recursive call to to align the mouse state with the touch state appropriately. fixes: efcfa0b252a (Application: send TouchCancel when touch is interrupted by popup) --- src/gui/kernel/qguiapplication.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index cff11367f7..04b07f5c8e 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2651,12 +2651,8 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To if (eventType == QEvent::TouchEnd) { // but don't leave dangling state: e.g. // QQuickWindowPrivate::itemForTouchPointId needs to be cleared. - QTouchEvent touchEvent(QEvent::TouchCancel, - e->device, - e->modifiers); - touchEvent.setTimestamp(e->timestamp); - touchEvent.setWindow(w); - QGuiApplication::sendSpontaneousEvent(w, &touchEvent); + QWindowSystemInterfacePrivate::TouchEvent fake(w, e->timestamp, QEvent::TouchCancel, e->device, e->points, e->modifiers); + processTouchEvent(&fake); } continue; } -- 2.11.0