From add0b0ea41fc7e8f73788288527511bb2c522975 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Fri, 27 Jul 2018 09:35:33 +0200 Subject: Fix touch input for HoloLens devices With newer HoloLens images every touch event has a pressure of 0.0. By checking both values we make sure that touch points are handled correctly for new and old images. Task-number: QTBUG-69651 Change-Id: Ic16e3416ffb7a89e4c1adbec1703e84aa962b211 Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/winrt') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 928fff32d6..e39a87148a 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -1250,10 +1250,11 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) boolean isPressed; pointerPoint->get_IsInContact(&isPressed); - // Devices like the Hololens set a static pressure of 0.5 independent - // of the pressed state. In those cases we need to synthesize the - // pressure value. To our knowledge this does not apply to pens - if (pointerDeviceType == PointerDeviceType_Touch && pressure == 0.5f) + // Devices like the Hololens set a static pressure of 0.0 or 0.5 + // (depending on the image) independent of the pressed state. + // In those cases we need to synthesize the pressure value. To our + // knowledge this does not apply to pens + if (pointerDeviceType == PointerDeviceType_Touch && (pressure == 0.0f || pressure == 0.5f)) pressure = isPressed ? 1. : 0.; const QRectF areaRect(area.X * d->scaleFactor, area.Y * d->scaleFactor, -- cgit v1.2.3