summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmwindow.cpp
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-11-28 15:24:58 +0100
committerMikolaj Boc <mikolaj.boc@qt.io>2022-11-30 20:05:10 +0100
commita812d1eb661ea5acedc3258405a1035781e3956b (patch)
tree80cffefd1a17aa61951fc4229e11f608d3a9948d /src/plugins/platforms/wasm/qwasmwindow.cpp
parenta9005a70d543db8c458f670a43c586d077b12417 (diff)
Don't tie compositor's enabled state to last added window
Currently, the compositor gets enabled/disabled based on the last constructed window's surface type. This causes non-OpenGL windows not to be displayed if any OpenGL window is created last. The compositor should scan for any non-openGL windows on any change to the window set to decide if it needs to be disabled or not. Change-Id: I037470e39a3fbae50fd3a4e29cb6615130d7b114 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmwindow.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp
index 182ae38fea4..4f9a9272778 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.cpp
+++ b/src/plugins/platforms/wasm/qwasmwindow.cpp
@@ -232,8 +232,8 @@ QWasmWindow::QWasmWindow(QWindow *w, QWasmCompositor *compositor, QWasmBackingSt
compositor->screen()->element().call<void>("appendChild", m_qtWindow);
- m_needsCompositor = w->surfaceType() != QSurface::OpenGLSurface;
- if (m_needsCompositor)
+ const bool rendersTo2dContext = w->surfaceType() != QSurface::OpenGLSurface;
+ if (rendersTo2dContext)
m_context2d = m_canvas.call<emscripten::val>("getContext", emscripten::val("2d"));
static int serialNo = 0;
m_winId = ++serialNo;
@@ -241,9 +241,6 @@ QWasmWindow::QWasmWindow(QWindow *w, QWasmCompositor *compositor, QWasmBackingSt
emscripten::val::module_property("specialHTMLTargets").set(canvasSelector(), m_canvas);
m_compositor->addWindow(this);
-
- // Pure OpenGL windows draw directly using egl, disable the compositor.
- m_compositor->setEnabled(w->surfaceType() != QSurface::OpenGLSurface);
}
QWasmWindow::~QWasmWindow()