diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp index 48445d5db95..ebc59a567c1 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 5de401844c3..4953d652338 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 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 01367bd56b3..f5cc3e2eee6 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(); + } } } diff --git a/tests/auto/wasm/selenium/qwasmwindow.py b/tests/auto/wasm/selenium/qwasmwindow.py index d66d57981a6..eaad7c4e00c 100644 --- a/tests/auto/wasm/selenium/qwasmwindow.py +++ b/tests/auto/wasm/selenium/qwasmwindow.py @@ -372,8 +372,6 @@ class WidgetTestCase(unittest.TestCase): self.assertFalse(w4 in screen.query_windows()) - #TODO FIX - @unittest.skip('Does not work currently') def test_window_painting(self): screen = Screen(self._driver, ScreenPosition.FIXED, x=0, y=0, width=800, height=800) @@ -389,13 +387,15 @@ class WidgetTestCase(unittest.TestCase): self.assertEqual(w1.color_at(0, 0), Color(r=0, g=255, b=0)) - w1_w1 = Window(parent=w1, rect=Rect(x=100, y=100, width=400, height=400), title='w1_w1') + w1_w1 = Window(parent=screen, rect=Rect(x=100, y=100, width=400, height=400), title='w1_w1') + w1_w1.set_parent(w1) w1_w1.set_background_color(Color(r=0, g=0, b=255)) wait_for_animation_frame(self._driver) self.assertEqual(w1_w1.color_at(0, 0), Color(r=0, g=0, b=255)) - w1_w1_w1 = Window(parent=w1_w1, rect=Rect(x=100, y=100, width=200, height=200), title='w1_w1_w1') + w1_w1_w1 = Window(parent=screen, rect=Rect(x=100, y=100, width=200, height=200), title='w1_w1_w1') + w1_w1_w1.set_parent(w1_w1) w1_w1_w1.set_background_color(Color(r=255, g=255, b=0)) wait_for_animation_frame(self._driver)