From 076f931de529a4faad980f0f60a3b4419b733e5a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 24 Oct 2013 11:32:15 +0200 Subject: eglfs: Perform initialization in initialize() instead of the constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 47 ++++++++++++----------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'src/plugins/platforms/eglfs/qeglfsintegration.cpp') 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(); } -- cgit v1.2.3