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 <shawn.rutledge@digia.com>
bb10
Jocelyn Turcotte 2013-08-01 13:40:36 +02:00 committed by The Qt Project
parent 76f32cadb2
commit 7495b59dbd
1 changed files with 5 additions and 3 deletions

View File

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