summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Spoerl <[email protected]>2023-09-07 14:44:26 +0200
committerQt Cherry-pick Bot <[email protected]>2023-09-25 08:52:09 +0000
commitb74b101a0616d83c76a23a0c56b5461e63e653ac (patch)
tree6ee9951a499081129177d27e4c6716548e303d48
parent31ae499e9a80742f0d988b8e2b695ddd3d9b7f08 (diff)
QOpenGLCompositorBackingStore: ensure backing store on flushed windows
When the first QEglFSWindow got created for a QWindow, a backing store was created with it and associated to the new QEglFSWindow. When the window was hidden on the platform screen, the QEglFSWindow got deleted and re-created when it was supposed to be shown. The re-created QEglFSWindow was no longer associated to the backing store. It was therefore not rendered on the screen. => ensure that the backing store is re-associated to the QEglFSWindow, corrsponding to the QWindow argument passed to flush(). No autotest is added, because the fix is purely visual. The widgets/menus example can be used to test the functionality manually (see bug reports). Fixes: QTBUG-115196 Fixes: QTBUG-116769 Pick-to: 6.2 Change-Id: I92ce2e8f7e76bd2d26e713a4d20612d079fb4717 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Eirik Aavitsland <[email protected]> (cherry picked from commit 4bc8f548222a0dd2967063a23e76c37d302253cb) Reviewed-by: Qt Cherry-pick Bot <[email protected]> (cherry picked from commit 4bc76c2647407ff3758d803a4b4c717699b5001a)
-rw-r--r--src/opengl/qopenglcompositor_p.h3
-rw-r--r--src/opengl/qopenglcompositorbackingstore.cpp3
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow_p.h4
3 files changed, 8 insertions, 2 deletions
diff --git a/src/opengl/qopenglcompositor_p.h b/src/opengl/qopenglcompositor_p.h
index abe8d4959ef..66dd77c1c21 100644
--- a/src/opengl/qopenglcompositor_p.h
+++ b/src/opengl/qopenglcompositor_p.h
@@ -29,6 +29,7 @@ class QOpenGLFramebufferObject;
class QWindow;
class QPlatformTextureList;
+class QOpenGLCompositorBackingStore;
class QOpenGLCompositorWindow
{
public:
@@ -37,6 +38,8 @@ public:
virtual const QPlatformTextureList *textures() const = 0;
virtual void beginCompositing() { }
virtual void endCompositing() { }
+ virtual void setBackingStore(QOpenGLCompositorBackingStore *backingStore) = 0;
+ virtual QOpenGLCompositorBackingStore *backingStore() const = 0;
};
class Q_OPENGL_EXPORT QOpenGLCompositor : public QObject
diff --git a/src/opengl/qopenglcompositorbackingstore.cpp b/src/opengl/qopenglcompositorbackingstore.cpp
index a5cc391e48f..841087ed6ff 100644
--- a/src/opengl/qopenglcompositorbackingstore.cpp
+++ b/src/opengl/qopenglcompositorbackingstore.cpp
@@ -137,6 +137,9 @@ void QOpenGLCompositorBackingStore::updateTexture()
void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
// Called for ordinary raster windows.
+ auto *handle = dynamic_cast<QOpenGLCompositorWindow *>(window->handle());
+ if (handle && !handle->backingStore())
+ handle->setBackingStore(this);
Q_UNUSED(region);
Q_UNUSED(offset);
diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
index d111042040a..e51cd69f3df 100644
--- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
@@ -70,8 +70,8 @@ public:
bool isRaster() const;
#ifndef QT_NO_OPENGL
- QOpenGLCompositorBackingStore *backingStore() { return m_backingStore; }
- void setBackingStore(QOpenGLCompositorBackingStore *backingStore);
+ QOpenGLCompositorBackingStore *backingStore() const override { return m_backingStore; }
+ void setBackingStore(QOpenGLCompositorBackingStore *backingStore) override;
QWindow *sourceWindow() const override;
const QPlatformTextureList *textures() const override;
void endCompositing() override;