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 <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Hyunkook Khang 2020-04-29 11:13:55 +09:00 committed by Volker Hilsheimer
parent c0f9fef33e
commit 7fa0a2e375

View File

@ -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