Stop propagation and default action on WASM window pointer event

The windows should not let events through to targets below (unless
they are Qt::WindowTransparentForInput, which is handled
independently). Therefore, stopPropagation and preventDefault are
now called regardless of whether the window has handled the event
or not. If the event is not handled explicitly, we still consume the
DOM event so that the windows/elements below don't get focus by
mistake.

Fixes: QTBUG-111706
Change-Id: Idc78ac5076e97992d9f6f13a1fa574d0df4178ac
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Mikolaj Boc 2023-03-08 10:18:04 +01:00
parent f3e27d3688
commit d34259d966

View File

@ -19,8 +19,9 @@ ClientArea::ClientArea(QWasmWindow *window, QWasmScreen *screen, emscripten::val
: m_screen(screen), m_window(window), m_element(element)
{
const auto callback = std::function([this](emscripten::val event) {
if (processPointer(*PointerEvent::fromWeb(event)))
processPointer(*PointerEvent::fromWeb(event));
event.call<void>("preventDefault");
event.call<void>("stopPropagation");
});
m_pointerDownCallback =