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.

Pick-to: 6.6 6.5
Change-Id: I1514329dc76ecc4b9103f7deca9642aaf304df8b
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
Morten Sørvig 2023-06-14 11:56:37 +02:00 committed by Morten Johan Sørvig
parent 2dcc30592b
commit 7a31911b79

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