diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> | 2013-02-27 17:08:03 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-28 17:10:55 +0100 |
commit | dedec0b305baabe894e53bf3b70560cec68e3464 (patch) | |
tree | f951f312296248bd7d9100d2de64e70468eef1c7 /src/plugins/platforms/eglfs/qeglfswindow.cpp | |
parent | f4d7b4d10f7d3badbb0ac5ad5c0754a044f8bdd2 (diff) |
EGLFS: Enablers for Android plugin
These are some changes that are needed to make the Android
plugin as a subclass of the EGLFS plugin.
Change-Id: I7c77931f311d8a07f9292715d2abc256c5d552d8
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfswindow.cpp')
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfswindow.cpp | 28 |
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) |