summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmevent.h
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/qwasmevent.h
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/qwasmevent.h')
-rw-r--r--src/plugins/platforms/wasm/qwasmevent.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/wasm/qwasmevent.h b/src/plugins/platforms/wasm/qwasmevent.h
index 9f43b6a85f..26b6b5f22a 100644
--- a/src/plugins/platforms/wasm/qwasmevent.h
+++ b/src/plugins/platforms/wasm/qwasmevent.h
@@ -114,7 +114,8 @@ struct Q_CORE_EXPORT Event
struct Q_CORE_EXPORT MouseEvent : public Event
{
- QPoint point;
+ QPoint localPoint;
+ QPoint pointInPage;
QPoint pointInViewport;
Qt::MouseButton mouseButton;
Qt::MouseButtons mouseButtons;