From 7a31911b795a3d07c6cba3af8436c3a38673689e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Wed, 14 Jun 2023 11:56:37 +0200 Subject: [PATCH] wasm: fix touch -> mouse event synth on Safari MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mobile Safari generates touch pointer events with negative pointer id's, which causes processTochEvent() to skip the event instead of synthesizing a mouse event. Ensure that the id's are always positive by taking the absolute value of the event. Pick-to: 6.6 6.5 Change-Id: I1514329dc76ecc4b9103f7deca9642aaf304df8b Reviewed-by: Piotr WierciƄski Reviewed-by: Lorn Potter --- src/plugins/platforms/wasm/qwasmwindowclientarea.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp b/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp index c93625f78d2..a0684e8ecf8 100644 --- a/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp +++ b/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp @@ -106,7 +106,10 @@ bool ClientArea::deliverEvent(const PointerEvent &event) .insert(event.pointerId, QWindowSystemInterface::TouchPoint()) .value(); - touchPoint->id = event.pointerId; + // Assign touch point id. TouchPoint::id is int, but QGuiApplicationPrivate::processTouchEvent() + // will not synthesize mouse events for touch points with negative id; use the absolute value for + // the touch point id. + touchPoint->id = qAbs(event.pointerId); touchPoint->state = QEventPoint::State::Pressed; }