From 7fa0a2e375197d3580d24bfca8b232522d5fd21d Mon Sep 17 00:00:00 2001 From: Hyunkook Khang Date: Wed, 29 Apr 2020 11:13:55 +0900 Subject: [PATCH] Fix touch being ignored when down and up are in the same frame The Wayland protocol gives no guarantees about which events are part of a frame, so handle the case where we receive wl_touch.down and wl_touch.up within the same frame. Fixes: QTBUG-89680 Change-Id: Ie0b9d2fb950fb0d9a6af8dd8ad2fa55a5efa71e6 Pick-to: 5.15 6.1 6.0 Reviewed-by: Volker Hilsheimer Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index fb9c63d8fec..420194733b9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1419,6 +1419,14 @@ void QWaylandInputDevice::handleTouchPoint(int id, Qt::TouchPointState state, co it = mTouch->mPendingTouchPoints.insert(end, QWindowSystemInterface::TouchPoint()); it->id = id; } + // If the touch points were up and down in same frame, send out frame right away + else if ((it->state == QEventPoint::Pressed && state == QEventPoint::Released) + || (it->state == QEventPoint::Released && state == QEventPoint::Pressed)) { + mTouch->touch_frame(); + it = mTouch->mPendingTouchPoints.insert(mTouch->mPendingTouchPoints.end(), QWindowSystemInterface::TouchPoint()); + it->id = id; + } + QWindowSystemInterface::TouchPoint &tp = *it; // Only moved and pressed needs to update/set position