eglfs: change the condition to destroy the openglcompositor
With an openglcompositor, only first QEglFSWindow is set with a flag, HasNativeWindow and when it is destroyed, the openglcompositor is destroyed, too. For now, when using openglcompositor, Qt will not check HasNativeWindow for its nativeWindow because it is not possible to add a HasNativeWindow flag in an existing window. And the openglcompositor will be destroyed after the all the QEglFSWindows are closed. Fixes: QTBUG-129576 Pick-to: 6.5 Change-Id: I620a904a03d29e8db1738d9392f716b3ebf5b553 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 39bcd4287a6146e6deba9c6a9fdb70298deed427) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
5ed1f61c56
commit
79312a5dc7
@ -273,9 +273,9 @@ void QOpenGLCompositor::addWindow(QOpenGLCompositorWindow *window)
|
||||
|
||||
void QOpenGLCompositor::removeWindow(QOpenGLCompositorWindow *window)
|
||||
{
|
||||
m_windows.removeOne(window);
|
||||
if (!m_windows.isEmpty())
|
||||
emit topWindowChanged(m_windows.last());
|
||||
bool couldChangeTopWindow = (m_windows.size() > 1) ? (window == m_windows.constLast()) : false;
|
||||
if (m_windows.removeOne(window) && couldChangeTopWindow)
|
||||
emit topWindowChanged(m_windows.constLast());
|
||||
}
|
||||
|
||||
void QOpenGLCompositor::moveToTop(QOpenGLCompositorWindow *window)
|
||||
|
@ -131,29 +131,42 @@ void QEglFSWindow::destroy()
|
||||
if (!m_flags.testFlag(Created))
|
||||
return; // already destroyed
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositor::instance()->removeWindow(this);
|
||||
#endif
|
||||
|
||||
QEglFSScreen *screen = this->screen();
|
||||
if (m_flags.testFlag(HasNativeWindow)) {
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
|
||||
compositor->removeWindow(this);
|
||||
if (compositor->targetWindow() == window()) {
|
||||
QEglFSCursor *cursor = qobject_cast<QEglFSCursor *>(screen->cursor());
|
||||
if (cursor)
|
||||
cursor->resetResources();
|
||||
#endif
|
||||
|
||||
if (screen->primarySurface() == m_surface)
|
||||
screen->setPrimarySurface(EGL_NO_SURFACE);
|
||||
|
||||
invalidateSurface();
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLCompositor::destroy();
|
||||
if (qt_gl_global_share_context() == m_rasterCompositingContext)
|
||||
qt_gl_set_global_share_context(nullptr);
|
||||
delete m_rasterCompositingContext;
|
||||
#endif
|
||||
if (compositor->windows().isEmpty()) {
|
||||
compositor->destroy();
|
||||
if (qt_gl_global_share_context() == m_rasterCompositingContext)
|
||||
qt_gl_set_global_share_context(nullptr);
|
||||
delete m_rasterCompositingContext;
|
||||
} else {
|
||||
auto topWindow = static_cast<QEglFSWindow *>(compositor->windows().last());
|
||||
// Make fullscreen
|
||||
topWindow->setGeometry(screen->rawGeometry());
|
||||
topWindow->resetSurface();
|
||||
screen->setPrimarySurface(topWindow->surface());
|
||||
compositor->setTargetWindow(topWindow->sourceWindow(), screen->rawGeometry());
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (m_flags.testFlag(HasNativeWindow)) {
|
||||
if (screen->primarySurface() == m_surface)
|
||||
screen->setPrimarySurface(EGL_NO_SURFACE);
|
||||
|
||||
invalidateSurface();
|
||||
}
|
||||
#endif
|
||||
|
||||
m_flags = { };
|
||||
}
|
||||
@ -181,7 +194,6 @@ void QEglFSWindow::invalidateSurface()
|
||||
if (screen()->primarySurface() == m_surface)
|
||||
screen()->setPrimarySurface(EGL_NO_SURFACE);
|
||||
|
||||
|
||||
m_surface = EGL_NO_SURFACE;
|
||||
m_flags = m_flags & ~Created;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user