From af30e7857e205990057735a07fe0974af9db8733 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 13 Sep 2018 11:02:57 +0200 Subject: Support offscreen plugin with glx backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-63346 Change-Id: Id475c6c88f79af8cf82610a40d07eaa3f6588d7d Reviewed-by: Jüri Valdmann --- src/core/content_browser_client_qt.cpp | 2 +- src/core/ozone/gl_context_qt.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 3eb224797..7440771cb 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -163,7 +163,7 @@ public: { QString platform = qApp->platformName().toLower(); QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface(); - if (platform == QLatin1String("xcb")) { + if (platform == QLatin1String("xcb") || platform == QLatin1String("offscreen")) { if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); else diff --git a/src/core/ozone/gl_context_qt.cpp b/src/core/ozone/gl_context_qt.cpp index 7e913817e..c4a075544 100644 --- a/src/core/ozone/gl_context_qt.cpp +++ b/src/core/ozone/gl_context_qt.cpp @@ -130,9 +130,10 @@ void* GLContextHelper::getEGLDisplay() void* GLContextHelper::getXDisplay() { - if (QGuiApplication::platformName() != QLatin1String("xcb")) - return nullptr; - return qApp->platformNativeInterface()->nativeResourceForScreen(QByteArrayLiteral("display"), qApp->primaryScreen()); + QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface(); + if (pni) + return pni->nativeResourceForScreen(QByteArrayLiteral("display"), qApp->primaryScreen()); + return nullptr; } void* GLContextHelper::getNativeDisplay() -- cgit v1.2.3