wasm: fix touch -> mouse event synth on Safari

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.

Change-Id: I1514329dc76ecc4b9103f7deca9642aaf304df8b
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 7a31911b795a3d07c6cba3af8436c3a38673689e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Morten Sørvig 2023-06-14 11:56:37 +02:00 committed by Qt Cherry-pick Bot
parent 970888356a
commit 07708f6e61

View File

@ -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;
}