summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmcompositor.cpp
diff options
context:
space:
mode:
authorDavid Skoland <david.skoland@qt.io>2021-12-06 13:43:34 +0100
committerMorten Johan Sørvig <morten.sorvig@qt.io>2022-12-20 18:13:47 +0000
commit4b1229e5235412062a5240410ec49e358019507c (patch)
treea7610c8f717f11e9a24ed6099b0455d2772cd07d /src/plugins/platforms/wasm/qwasmcompositor.cpp
parentaf0f13b46053254c7b2416a1f71a95d141247600 (diff)
Set WASM platform default to synchronous window event handling
Based on existing code, it appears that it's always preferred in wasm to use synchronous delivery (<QWindowSystemInterface::SynchronousDelivery>), however, we can simply define this as the default mode of operation, which will make these unnecessary. Change-Id: Ia4c78593333e314f91efb266268917317794e2f5 Pick-to: 6.5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmcompositor.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp
index 0f082543ff4..f4f2d1b11dd 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp
@@ -54,7 +54,9 @@ QWasmCompositor::QWasmCompositor(QWasmScreen *screen)
QPointingDevice::Capability::Position | QPointingDevice::Capability::Area
| QPointingDevice::Capability::NormalizedPosition,
10, 0);
+
QWindowSystemInterface::registerInputDevice(m_touchDevice.get());
+ QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
}
QWasmCompositor::~QWasmCompositor()
@@ -283,7 +285,7 @@ void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDel
window->QPlatformWindow::deliverUpdateRequest();
} else {
QWindow *qwindow = window->window();
- QWindowSystemInterface::handleExposeEvent<QWindowSystemInterface::SynchronousDelivery>(
+ QWindowSystemInterface::handleExposeEvent(
qwindow, QRect(QPoint(0, 0), qwindow->geometry().size()));
}
}
@@ -472,7 +474,7 @@ bool QWasmCompositor::deliverEventToTarget(const PointerEvent &event, QWindow *e
MouseEvent::mouseEventTypeFromEventType(event.type, windowArea);
return eventType != QEvent::None &&
- QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(
+ QWindowSystemInterface::handleMouseEvent(
eventTarget, QWasmIntegration::getTimestamp(),
eventTarget->mapFromGlobal(targetPointClippedToScreen),
targetPointClippedToScreen, event.mouseButtons, event.mouseButton,
@@ -574,7 +576,7 @@ bool QWasmCompositor::processKeyboard(int eventType, const EmscriptenKeyboardEve
if (translatedEvent.text.size() > 1)
translatedEvent.text.clear();
const auto result =
- QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(
+ QWindowSystemInterface::handleKeyEvent(
0, translatedEvent.type, translatedEvent.key, modifiers, translatedEvent.text);
return clipboardResult == ProcessKeyboardResult::NativeClipboardEventAndCopiedDataNeeded
? ProceedToNativeEvent
@@ -701,7 +703,7 @@ bool QWasmCompositor::processTouch(int eventType, const EmscriptenTouchEvent *to
if (eventType == EMSCRIPTEN_EVENT_TOUCHCANCEL)
accepted = QWindowSystemInterface::handleTouchCancelEvent(targetWindow, QWasmIntegration::getTimestamp(), m_touchDevice.get(), keyModifier);
else
- accepted = QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(
+ accepted = QWindowSystemInterface::handleTouchEvent(
targetWindow, QWasmIntegration::getTimestamp(), m_touchDevice.get(), touchPointList, keyModifier);
return static_cast<int>(accepted);
@@ -721,12 +723,12 @@ void QWasmCompositor::releaseCapture()
void QWasmCompositor::leaveWindow(QWindow *window)
{
m_windowUnderMouse = nullptr;
- QWindowSystemInterface::handleLeaveEvent<QWindowSystemInterface::SynchronousDelivery>(window);
+ QWindowSystemInterface::handleLeaveEvent(window);
}
void QWasmCompositor::enterWindow(QWindow *window, const QPoint &pointInTargetWindowCoords, const QPoint &targetPointInScreenCoords)
{
- QWindowSystemInterface::handleEnterEvent<QWindowSystemInterface::SynchronousDelivery>(window, pointInTargetWindowCoords, targetPointInScreenCoords);
+ QWindowSystemInterface::handleEnterEvent(window, pointInTargetWindowCoords, targetPointInScreenCoords);
}
bool QWasmCompositor::processMouseEnter(const EmscriptenMouseEvent *mouseEvent)