Fix build without egl_x11

Amends 49d29440457a89bb0438ed882eb47f4f28fd328a

Pick-to: 6.5
Change-Id: I5ff94135245cdb617aa5eea5a0e2782f810b36dc
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Ilya Fedin 2023-03-22 23:47:00 +04:00
parent 01cdda3502
commit 6f37399cd6
2 changed files with 15 additions and 0 deletions

View File

@ -97,11 +97,13 @@ bool QXcbEglIntegration::initialize(QXcbConnection *connection)
EGLint major, minor;
bool success = eglInitialize(m_egl_display, &major, &minor);
#if QT_CONFIG(egl_x11)
if (!success) {
m_egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
qCDebug(lcQpaGl) << "Xcb EGL gl-integration retrying with display" << m_egl_display;
success = eglInitialize(m_egl_display, &major, &minor);
}
#endif
m_native_interface_handler.reset(new QXcbEglNativeInterfaceHandler(connection->nativeInterface()));

View File

@ -7,6 +7,10 @@
#include <QtGui/private/qeglconvenience_p.h>
#ifndef EGL_EXT_platform_base
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
#endif
QT_BEGIN_NAMESPACE
QXcbEglWindow::QXcbEglWindow(QWindow *window, QXcbEglIntegration *glIntegration)
@ -42,7 +46,16 @@ void QXcbEglWindow::create()
{
QXcbWindow::create();
#if QT_CONFIG(egl_x11)
m_surface = eglCreateWindowSurface(m_glIntegration->eglDisplay(), m_config, m_window, nullptr);
#else
auto createPlatformWindowSurface = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>(
eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT"));
m_surface = createPlatformWindowSurface(m_glIntegration->eglDisplay(),
m_config,
reinterpret_cast<void *>(m_window),
nullptr);
#endif
}
QT_END_NAMESPACE