summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorEven Oscar Andersen <even.oscar.andersen@qt.io>2024-03-01 11:32:05 +0100
committerEven Oscar Andersen <even.oscar.andersen@qt.io>2024-03-05 17:58:14 +0100
commitd8a6a9bfcbaec96156751c0ecaf2aa78e4e8c9e8 (patch)
tree96729e80e536737c16c43025b9f6c385fe312cca /src/plugins/platforms
parente06c67d448a6b4684d9787e9c18ec12f884b7063 (diff)
wasm: Make sure we can add screen after releaseRequestUpdateHold has been called
Before this fix, such screens would not render due to requestUpdateHold is initialized to true and never reset. The fix is to change the requestUpdateHold member to be a static variable, so that it can be read by screens added after requestUpdateHold has been called. Also, add a test that would fail without this fix Change-Id: Idf2ac916766a03480272cd550f9d1ab7fc5c5158 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.cpp9
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.h7
-rw-r--r--src/plugins/platforms/wasm/qwasmintegration.cpp7
3 files changed, 14 insertions, 9 deletions
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp
index 48445d5db9..ebc59a567c 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp
@@ -12,6 +12,8 @@
using namespace emscripten;
+bool QWasmCompositor::m_requestUpdateHoldEnabled = true;
+
QWasmCompositor::QWasmCompositor(QWasmScreen *screen) : QObject(screen)
{
QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
@@ -46,12 +48,11 @@ void QWasmCompositor::setEnabled(bool enabled)
// requestUpdate delivery is initially disabled at startup, while Qt completes
// startup tasks such as font loading. This function enables requestUpdate delivery
// again.
-void QWasmCompositor::releaseRequesetUpdateHold()
+bool QWasmCompositor::releaseRequestUpdateHold()
{
- if (!m_requestUpdateHoldEnabled)
- return;
+ const bool wasEnabled = m_requestUpdateHoldEnabled;
m_requestUpdateHoldEnabled = false;
- requestUpdate();
+ return wasEnabled;
}
void QWasmCompositor::requestUpdateWindow(QWasmWindow *window, UpdateRequestDeliveryType updateType)
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.h b/src/plugins/platforms/wasm/qwasmcompositor.h
index 5de401844c..4953d65233 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.h
+++ b/src/plugins/platforms/wasm/qwasmcompositor.h
@@ -31,7 +31,9 @@ public:
QWasmScreen *screen();
void setEnabled(bool enabled);
- void releaseRequesetUpdateHold();
+ static bool releaseRequestUpdateHold();
+
+ void requestUpdate();
enum UpdateRequestDeliveryType { ExposeEventDelivery, UpdateRequestDelivery };
void requestUpdateWindow(QWasmWindow *window, UpdateRequestDeliveryType updateType = ExposeEventDelivery);
@@ -43,15 +45,14 @@ private:
void deregisterEventHandlers();
- void requestUpdate();
void deliverUpdateRequests();
void deliverUpdateRequest(QWasmWindow *window, UpdateRequestDeliveryType updateType);
bool m_isEnabled = true;
QMap<QWasmWindow *, UpdateRequestDeliveryType> m_requestUpdateWindows;
int m_requestAnimationFrameId = -1;
- bool m_requestUpdateHoldEnabled = true;
bool m_inDeliverUpdateRequest = false;
+ static bool m_requestUpdateHoldEnabled;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp
index 01367bd56b..f5cc3e2eee 100644
--- a/src/plugins/platforms/wasm/qwasmintegration.cpp
+++ b/src/plugins/platforms/wasm/qwasmintegration.cpp
@@ -208,8 +208,11 @@ void QWasmIntegration::removeBackingStore(QWindow* window)
void QWasmIntegration::releaseRequesetUpdateHold()
{
- for (const auto &elementAndScreen : m_screens) {
- elementAndScreen.wasmScreen->compositor()->releaseRequesetUpdateHold();
+ if (QWasmCompositor::releaseRequestUpdateHold())
+ {
+ for (const auto &elementAndScreen : m_screens) {
+ elementAndScreen.wasmScreen->compositor()->requestUpdate();
+ }
}
}