summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHyunkook Khang <hyunkook.khang@qt.io>2020-04-29 11:13:55 +0900
committerHyunkook Khang <hyunkook.khang@qt.io>2021-04-14 23:46:14 +0900
commit5eddb747e8bb5f452e247ea388ef1f6fa37783e7 (patch)
tree37484b0cb882d0d04060b11c7865db646a2ad8e5
parent34b066db62d807655f2f39d5eb173a771cbe5b10 (diff)
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 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit da31aa6544f38c063de93326f958e8cbb02004af) Reviewed-by: Hyunkook Khang <hyunkook.khang@qt.io>
-rw-r--r--src/client/qwaylandinputdevice.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index 3a61ced48..9490a66d9 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -1407,6 +1407,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 == Qt::TouchPointPressed && state == Qt::TouchPointReleased)
+ || (it->state == Qt::TouchPointReleased && state == Qt::TouchPointPressed)) {
+ 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