diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-05-06 18:21:42 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-09 13:24:45 +0200 |
commit | 3b6d8ba49b39b75dda33fb3c3a784330791efed2 (patch) | |
tree | af2557d81a8d7813b55268d4cd740acd3090160a | |
parent | 5c287474541c865cc9e3e7caa1a6b819041d8279 (diff) |
Add support for querying "display" from eglfs
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 <jorgen.lind@digia.com>
-rw-r--r-- | src/platformsupport/eglconvenience/qeglplatformintegration.cpp | 23 | ||||
-rw-r--r-- | src/platformsupport/eglconvenience/qeglplatformintegration_p.h | 1 |
2 files changed, 22 insertions, 2 deletions
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<void*>(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; |