winrt: Avoid superfluous touch events for multitouch

A touch press event's state has to be set to "stationary" after the
touch event (including its list of touch points) has been passed to the
QWindowSystemInterface. Following touch events (that are caused by another
id) will not change the press event's state which can otherwise cause more
than one press event for a given id in a multitouch setup.

Task-number: QTBUG-58793
Change-Id: I44628912251beacfbda7dd37059577cb1d085bd5
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Oliver Wolff 2018-07-10 15:05:49 +02:00 committed by Oliver Wolff
parent a0e2705f1f
commit 1faf5a3610

View File

@ -1265,7 +1265,8 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
it.value().id = id;
}
if (isPressed && it.value().pressure == 0.)
const bool wasPressEvent = isPressed && it.value().pressure == 0.;
if (wasPressEvent)
it.value().state = Qt::TouchPointPressed;
else if (!isPressed && it.value().pressure > 0.)
it.value().state = Qt::TouchPointReleased;
@ -1279,6 +1280,8 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
it.value().pressure = pressure;
QWindowSystemInterface::handleTouchEvent(d->currentTargetWindow, d->touchDevice, d->touchPoints.values(), mods);
if (wasPressEvent)
it.value().state = Qt::TouchPointStationary;
// Fall-through for pen to generate tablet event
if (pointerDeviceType != PointerDeviceType_Pen)