xcb qpa: initialize EGL for non-XLib builds

Move the EGL initialization code outside of the XLib ifdefs, so it
can be enabled for non-XLib builds as well

Change-Id: Ie025551e4e99bb0b365f025356bd9725f4283b82
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
Andrew Knight 2013-12-02 11:15:31 +02:00 committed by The Qt Project
parent fcfb62626b
commit 28d77c24c2

View File

@ -274,21 +274,22 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
XSetEventQueueOwner(dpy, XCBOwnsEventQueue);
XSetErrorHandler(nullErrorHandler);
m_xlib_display = dpy;
#ifdef XCB_USE_EGL
EGLDisplay eglDisplay = eglGetDisplay(dpy);
m_egl_display = eglDisplay;
EGLint major, minor;
eglBindAPI(EGL_OPENGL_ES_API);
m_has_egl = eglInitialize(eglDisplay,&major,&minor);
#endif //XCB_USE_EGL
}
#else
EGLNativeDisplayType dpy = EGL_DEFAULT_DISPLAY;
m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreen);
#endif //XCB_USE_XLIB
if (!m_connection || xcb_connection_has_error(m_connection))
qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData());
#ifdef XCB_USE_EGL
EGLDisplay eglDisplay = eglGetDisplay(dpy);
m_egl_display = eglDisplay;
EGLint major, minor;
m_has_egl = eglInitialize(eglDisplay, &major, &minor);
#endif //XCB_USE_EGL
m_reader = new QXcbEventReader(this);
m_reader->start();