summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmscreen.cpp
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-12-06 08:42:34 +0100
committerMikołaj Boc <Mikolaj.Boc@qt.io>2022-12-07 13:03:03 +0000
commit4d07f843072b367f45cb636d49415ceb92ca1dd9 (patch)
treee4403fd6e3fed787f13667e068c86835aa1b2f8c /src/plugins/platforms/wasm/qwasmscreen.cpp
parent6d780fa0aba2d53379c51c8c7439def8fad781aa (diff)
Fix the coordinate problems in wasm windows
The QWasmScreen's top left coordinate does not precisely translate to correct page coordinates, especially when fixed position is used and page margins are set. Also, this is wrong in complicated setups with e.g. multiple nested elements. Therefore, to get the correct coordinates in pointer event handlers, we have to assume the local coordinates of the screen, and translate those to the (possibly incorrect) coordinates that QWasmScreen thinks it has in page. It is another problem to fix the wrong coordinates QWasmScreen thinks it has in the page. This has been checked with complicated setups with screens in scroll containers, screens with fixed position, screens with relative position, with and without body margins etc. Change-Id: I749f2507fec7ae278b6f9d7d13ae288e65472dba Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmscreen.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp
index 0e7d3e10a76..366d4950897 100644
--- a/src/plugins/platforms/wasm/qwasmscreen.cpp
+++ b/src/plugins/platforms/wasm/qwasmscreen.cpp
@@ -223,6 +223,11 @@ QWindow *QWasmScreen::topLevelAt(const QPoint &p) const
return m_compositor->windowAt(p);
}
+QPoint QWasmScreen::mapFromLocal(const QPoint &p) const
+{
+ return geometry().topLeft() + p;
+}
+
QPoint QWasmScreen::clipPoint(const QPoint &p) const
{
return QPoint(