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 <maurice.kalinowski@qt.io>
bb10
Oliver Wolff 2018-07-27 09:35:33 +02:00
parent 2e88340ad2
commit add0b0ea41
1 changed files with 5 additions and 4 deletions

View File

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