summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-10-14 15:26:16 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-18 00:33:41 +0000
commit52cf91622a628ababfd39514c0e1b465d1a70b89 (patch)
treedbc5aa9d725966ae71ec32f2e3b5b6345aa5c97e
parent06538b99bbdb29356a5c1307a924d583327d73ad (diff)
Use new x11 native interface to query xdisplay
The call to nativeResourceForScreen can return egl native display handle if called with "display", since it gets mapped to XLibDisplay but egl device intergration can return EGLDisplay. This is not the case for nativeResourceForIntegration. Use new native QX11Application interface to query for display, note there is not need to use nativeResourceForScreen for "display" anyway since qt does not support multiple x connections to different displays. This fixes places where code queries "display" and bails out if it is null. Fixes: QTBUG-97472 Change-Id: Ibc5f8f96e612389bfa24a81268202c9e47a7580b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 23cc5bb2588100c6053d9d11b20778724cdbd6e7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/core/ozone/gl_context_qt.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/ozone/gl_context_qt.cpp b/src/core/ozone/gl_context_qt.cpp
index 1dd7d8f6e..8f9093a4e 100644
--- a/src/core/ozone/gl_context_qt.cpp
+++ b/src/core/ozone/gl_context_qt.cpp
@@ -141,10 +141,12 @@ void* GLContextHelper::getEGLDisplay()
void* GLContextHelper::getXDisplay()
{
- QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface();
- if (pni)
- return pni->nativeResourceForScreen(QByteArrayLiteral("display"), qApp->primaryScreen());
+#if QT_CONFIG(xcb)
+ auto *x11app = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
+ return x11app ? x11app->display() : nullptr;
+#else
return nullptr;
+#endif
}
void* GLContextHelper::getNativeDisplay()