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>
This commit is contained in:
Laszlo Agocs 2013-10-24 11:32:15 +02:00 committed by The Qt Project
parent a0da5290ff
commit 076f931de5

View File

@ -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();
}