Skip to content

Commit 4bc8f54

Browse files
committed
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.6 6.5 6.2 Change-Id: I92ce2e8f7e76bd2d26e713a4d20612d079fb4717 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
1 parent e26e6d6 commit 4bc8f54

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/opengl/qopenglcompositor_p.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class QOpenGLFramebufferObject;
2929
class QWindow;
3030
class QPlatformTextureList;
3131

32+
class QOpenGLCompositorBackingStore;
3233
class QOpenGLCompositorWindow
3334
{
3435
public:
@@ -37,6 +38,8 @@ class QOpenGLCompositorWindow
3738
virtual const QPlatformTextureList *textures() const = 0;
3839
virtual void beginCompositing() { }
3940
virtual void endCompositing() { }
41+
virtual void setBackingStore(QOpenGLCompositorBackingStore *backingStore) = 0;
42+
virtual QOpenGLCompositorBackingStore *backingStore() const = 0;
4043
};
4144

4245
class Q_OPENGL_EXPORT QOpenGLCompositor : public QObject

src/opengl/qopenglcompositorbackingstore.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ void QOpenGLCompositorBackingStore::updateTexture()
137137
void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
138138
{
139139
// Called for ordinary raster windows.
140+
auto *handle = dynamic_cast<QOpenGLCompositorWindow *>(window->handle());
141+
if (handle && !handle->backingStore())
142+
handle->setBackingStore(this);
140143

141144
Q_UNUSED(region);
142145
Q_UNUSED(offset);

src/plugins/platforms/eglfs/api/qeglfswindow_p.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow
7070
bool isRaster() const;
7171

7272
#ifndef QT_NO_OPENGL
73-
QOpenGLCompositorBackingStore *backingStore() { return m_backingStore; }
74-
void setBackingStore(QOpenGLCompositorBackingStore *backingStore);
73+
QOpenGLCompositorBackingStore *backingStore() const override { return m_backingStore; }
74+
void setBackingStore(QOpenGLCompositorBackingStore *backingStore) override;
7575
QWindow *sourceWindow() const override;
7676
const QPlatformTextureList *textures() const override;
7777
void endCompositing() override;

0 commit comments

Comments
 (0)