summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs/qeglfswindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfswindow.cpp')
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index 4a0e2a9a7d..68cef6253e 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -84,11 +84,28 @@ void QEglFSWindow::create()
EGLDisplay display = (static_cast<QEglFSScreen *>(window()->screen()->handle()))->display();
QSurfaceFormat platformFormat = QEglFSHooks::hooks()->surfaceFormatFor(window()->requestedFormat());
- EGLConfig config = QEglFSIntegration::chooseConfig(display, platformFormat);
+ m_config = QEglFSIntegration::chooseConfig(display, platformFormat);
+ m_format = q_glFormatFromConfig(display, m_config);
+ resetSurface();
+}
+
+void QEglFSWindow::invalidateSurface()
+{
+ // Native surface has been deleted behind our backs
+ m_window = 0;
+ if (m_surface != 0) {
+ EGLDisplay display = (static_cast<QEglFSScreen *>(window()->screen()->handle()))->display();
+ eglDestroySurface(display, m_surface);
+ m_surface = 0;
+ }
+}
+
+void QEglFSWindow::resetSurface()
+{
+ EGLDisplay display = static_cast<QEglFSScreen *>(screen())->display();
- m_format = q_glFormatFromConfig(display, config);
m_window = QEglFSHooks::hooks()->createNativeWindow(QEglFSHooks::hooks()->screenSize(), m_format);
- m_surface = eglCreateWindowSurface(display, config, m_window, NULL);
+ m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL);
if (m_surface == EGL_NO_SURFACE) {
EGLint error = eglGetError();
eglTerminate(display);
@@ -99,7 +116,7 @@ void QEglFSWindow::create()
void QEglFSWindow::destroy()
{
if (m_surface) {
- EGLDisplay display = (static_cast<QEglFSScreen *>(window()->screen()->handle()))->display();
+ EGLDisplay display = static_cast<QEglFSScreen *>(screen())->display();
eglDestroySurface(display, m_surface);
m_surface = 0;
}
@@ -114,9 +131,8 @@ void QEglFSWindow::setGeometry(const QRect &)
{
// We only support full-screen windows
QRect rect(screen()->availableGeometry());
- QWindowSystemInterface::handleGeometryChange(window(), rect);
-
QPlatformWindow::setGeometry(rect);
+ QWindowSystemInterface::handleGeometryChange(window(), rect);
}
void QEglFSWindow::setWindowState(Qt::WindowState)