From 7495b59dbda45049ba54f3682904962c217a9906 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Thu, 1 Aug 2013 13:40:36 +0200 Subject: [PATCH] xcb: Fix TouchPointPressed being sent multiple times. XI2 sends events for individual touch points, but QTouchEvent sends all of them with a stationary state if they didn't change. If a touch pressed event is received, and the next XI2 event is about a different touch point, we wouldn't update the state of the previously pressed touch point. Change-Id: I1ebcbea1cea54872064ef7710e2aac7b0b41cd70 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 991c82eaaa..799bb387e1 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -309,8 +309,6 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) case XI_TouchUpdate: if (touchPoint.area.center() != QPoint(x, y)) touchPoint.state = Qt::TouchPointMoved; - else - touchPoint.state = Qt::TouchPointStationary; break; case XI_TouchEnd: touchPoint.state = Qt::TouchPointReleased; @@ -323,9 +321,13 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) " area " << touchPoint.area << " pressure " << touchPoint.pressure; #endif QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xiEvent->time, dev->qtTouchDevice, m_touchPoints.values()); - // If a touchpoint was released, we can forget it, because the ID won't be reused. if (touchPoint.state == Qt::TouchPointReleased) + // If a touchpoint was released, we can forget it, because the ID won't be reused. m_touchPoints.remove(touchPoint.id); + else + // Make sure that we don't send TouchPointPressed/Moved in more than one QTouchEvent + // with this touch point if the next XI2 event is about a different touch point. + touchPoint.state = Qt::TouchPointStationary; } } #endif