eglfs: delete screen on exit

Delete the screen when the integration gets deleted. The screen destructor
destroys the window surface and terminates the egl connection. Note that the
egl context is not destroyed since it is managed by QOpenGLContext.

Change-Id: Ifb91c20edb6d5db684c37fb84d5ff40436f40925
Reviewed-by: Donald Carr <donald.carr@nokia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Girish Ramakrishnan 2012-04-02 14:34:36 -07:00 committed by Qt by Nokia
parent f578e52363
commit f913859f88
4 changed files with 18 additions and 3 deletions

View File

@ -57,15 +57,20 @@
QT_BEGIN_NAMESPACE
QEglFSIntegration::QEglFSIntegration()
: mFontDb(new QGenericUnixFontDatabase())
: mFontDb(new QGenericUnixFontDatabase()), mScreen(new QEglFSScreen(EGL_DEFAULT_DISPLAY))
{
screenAdded(new QEglFSScreen(EGL_DEFAULT_DISPLAY));
screenAdded(mScreen);
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglIntegration\n");
#endif
}
QEglFSIntegration::~QEglFSIntegration()
{
delete mScreen;
}
bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
switch (cap) {

View File

@ -55,6 +55,7 @@ class QEglFSIntegration : public QPlatformIntegration
{
public:
QEglFSIntegration();
~QEglFSIntegration();
bool hasCapability(QPlatformIntegration::Capability cap) const;
@ -70,6 +71,7 @@ public:
private:
QPlatformFontDatabase *mFontDb;
QPlatformScreen *mScreen;
};
QT_END_NAMESPACE

View File

@ -146,6 +146,14 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display)
eglSwapInterval(m_dpy, swapInterval);
}
QEglFSScreen::~QEglFSScreen()
{
if (m_surface)
eglDestroySurface(m_dpy, m_surface);
eglTerminate(m_dpy);
}
void QEglFSScreen::createAndSetPlatformContext() const {
const_cast<QEglFSScreen *>(this)->createAndSetPlatformContext();
}

View File

@ -56,7 +56,7 @@ class QEglFSScreen : public QPlatformScreen //huh: FullScreenScreen ;) just to f
{
public:
QEglFSScreen(EGLNativeDisplayType display);
~QEglFSScreen() {}
~QEglFSScreen();
QRect geometry() const;
int depth() const;