summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Sørvig <[email protected]>2023-06-14 11:56:37 +0200
committerQt Cherry-pick Bot <[email protected]>2023-07-03 12:44:16 +0000
commit16661d72af7cad6ef4f692af7ac4a96df5e76325 (patch)
tree9c5ed01249208efd6e8bdcc8166e7b5180948fd5
parente8fb9f65d5e003e38e1b8691a339658ff6003926 (diff)
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 <[email protected]> Reviewed-by: Lorn Potter <[email protected]> (cherry picked from commit 7a31911b795a3d07c6cba3af8436c3a38673689e) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
-rw-r--r--src/plugins/platforms/wasm/qwasmwindowclientarea.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp b/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp
index e3b681adb5e..83b7dbd5304 100644
--- a/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp
+++ b/src/plugins/platforms/wasm/qwasmwindowclientarea.cpp
@@ -105,7 +105,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;
}