From 1faf5a36106ed55e7c15ad25d225ccf790b759d5 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 10 Jul 2018 15:05:49 +0200 Subject: 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 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/winrt') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 531e843829..928fff32d6 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -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) -- cgit v1.2.3