From 3b6d8ba49b39b75dda33fb3c3a784330791efed2 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 6 May 2014 18:21:42 +0200 Subject: Add support for querying "display" from eglfs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return the native display which, with the x11 hooks, is the X11 Display*. This gives compatibility with xcb and allows QtWebEngine to run on eglfs in regular desktop builds without ozone. (this requires eglfs built with the x11 hooks of course) Change-Id: I8d25e2835c41a7e78f063a57a7d6c6b5e53a19b4 Reviewed-by: Jørgen Lind --- .../eglconvenience/qeglplatformintegration.cpp | 23 ++++++++++++++++++++-- .../eglconvenience/qeglplatformintegration_p.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp index 820c433a2c..3de0642c93 100644 --- a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp @@ -190,7 +190,8 @@ enum ResourceType { EglDisplay, EglWindow, EglContext, - NativeDisplay + NativeDisplay, + Display }; static int resourceType(const QByteArray &key) @@ -199,7 +200,8 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("egldisplay"), QByteArrayLiteral("eglwindow"), QByteArrayLiteral("eglcontext"), - QByteArrayLiteral("nativedisplay") + QByteArrayLiteral("nativedisplay"), + QByteArrayLiteral("display") }; const QByteArray *end = names + sizeof(names) / sizeof(names[0]); const QByteArray *result = std::find(names, end, key); @@ -226,6 +228,23 @@ void *QEGLPlatformIntegration::nativeResourceForIntegration(const QByteArray &re return result; } +void *QEGLPlatformIntegration::nativeResourceForScreen(const QByteArray &resource, QScreen *) +{ + void *result = 0; + + switch (resourceType(resource)) { + case Display: + // Play nice when using the x11 hooks: Be compatible with xcb that allows querying + // the X Display pointer, which is nothing but our native display. + result = reinterpret_cast(nativeDisplay()); + break; + default: + break; + } + + return result; +} + void *QEGLPlatformIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) { void *result = 0; diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h index f665455383..0de8cc9a33 100644 --- a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h @@ -79,6 +79,7 @@ public: QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; // QPlatformNativeInterface void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE; + void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) Q_DECL_OVERRIDE; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE; void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE; NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE; -- cgit v1.2.3