diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2013-10-24 11:32:15 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-25 20:50:51 +0200 |
commit | 076f931de529a4faad980f0f60a3b4419b733e5a (patch) | |
tree | 92b84db691b9b3bf55cfd91d824863c7897f612f | |
parent | a0da5290ff1898c456e34e03cc7a994984172880 (diff) |
eglfs: Perform initialization in initialize() instead of the constructor
Move (almost) everything to initialize(). Doing so allows the QEglFSScreen
constructor, the hooks' platformInit() and others to perform tasks that need
the event dispatcher.
Task-number: QTBUG-34208
Change-Id: If64e3d1691c41752c53968f8d4fb063b45345680
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfsintegration.cpp | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 67f0c35ed7..8a526dbff5 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -79,30 +79,9 @@ QT_BEGIN_NAMESPACE QEglFSIntegration::QEglFSIntegration() : mFontDb(new QGenericUnixFontDatabase) , mServices(new QGenericUnixServices) + , mScreen(0) , mInputContext(0) { - QEglFSHooks::hooks()->platformInit(); - - EGLint major, minor; - - if (!eglBindAPI(EGL_OPENGL_ES_API)) { - qWarning("Could not bind GL_ES API\n"); - qFatal("EGL error"); - } - - mDisplay = eglGetDisplay(QEglFSHooks::hooks() ? QEglFSHooks::hooks()->platformDisplay() : EGL_DEFAULT_DISPLAY); - if (mDisplay == EGL_NO_DISPLAY) { - qWarning("Could not open egl display\n"); - qFatal("EGL error"); - } - - if (!eglInitialize(mDisplay, &major, &minor)) { - qWarning("Could not initialize egl display\n"); - qFatal("EGL error"); - } - - mScreen = new QEglFSScreen(mDisplay); - screenAdded(mScreen); } QEglFSIntegration::~QEglFSIntegration() @@ -166,7 +145,31 @@ QAbstractEventDispatcher *QEglFSIntegration::createEventDispatcher() const void QEglFSIntegration::initialize() { + QEglFSHooks::hooks()->platformInit(); + + EGLint major, minor; + + if (!eglBindAPI(EGL_OPENGL_ES_API)) { + qWarning("Could not bind GL_ES API\n"); + qFatal("EGL error"); + } + + mDisplay = eglGetDisplay(QEglFSHooks::hooks() ? QEglFSHooks::hooks()->platformDisplay() : EGL_DEFAULT_DISPLAY); + if (mDisplay == EGL_NO_DISPLAY) { + qWarning("Could not open egl display\n"); + qFatal("EGL error"); + } + + if (!eglInitialize(mDisplay, &major, &minor)) { + qWarning("Could not initialize egl display\n"); + qFatal("EGL error"); + } + + mScreen = new QEglFSScreen(mDisplay); + screenAdded(mScreen); + mInputContext = QPlatformInputContextFactory::create(); + createInputHandlers(); } |