From 711d0a16580022d9f38a782f269f5cc3af0f3af7 Mon Sep 17 00:00:00 2001 From: Arvid Nilsson Date: Tue, 12 Nov 2013 10:27:28 +0100 Subject: [PATCH] Add QQnxNativeInterface::nativeResourceForContext This mechanism is used by QtWebEngine to extract the platform GL context. In the QNX case, the platform context is an EGL context, so the resource you need to ask for is the "eglcontext". Compare to the xcb native interface which has a similar implementation already. Change-Id: I873eaadf96898abb24de347ac624c88cd54254cb Reviewed-by: Jocelyn Turcotte Reviewed-by: Kevin Krammer Reviewed-by: Fabian Bumberger --- src/plugins/platforms/qnx/qqnxglcontext.h | 2 ++ src/plugins/platforms/qnx/qqnxnativeinterface.cpp | 10 ++++++++++ src/plugins/platforms/qnx/qqnxnativeinterface.h | 1 + 3 files changed, 13 insertions(+) diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h index ff57861498..2b12657da9 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.h +++ b/src/plugins/platforms/qnx/qqnxglcontext.h @@ -75,6 +75,8 @@ public: static EGLDisplay getEglDisplay(); EGLConfig getEglConfig() const { return m_eglConfig;} + EGLContext getEglContext() const { return m_eglContext; } + private: //Can be static because different displays returne the same handle static EGLDisplay ms_eglDisplay; diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp index 8958a5c1e2..6e7fc35a82 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp @@ -41,9 +41,11 @@ #include "qqnxnativeinterface.h" +#include "qqnxglcontext.h" #include "qqnxscreen.h" #include "qqnxwindow.h" +#include #include #include @@ -71,6 +73,14 @@ void *QQnxNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q return 0; } +void *QQnxNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) +{ + if (resource == "eglcontext" && context) + return static_cast(context->handle())->getEglContext(); + + return 0; +} + void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) { if (name == QStringLiteral("mmRendererWindowName")) { diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.h b/src/plugins/platforms/qnx/qqnxnativeinterface.h index b61f6a56cc..dfd386214e 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.h +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.h @@ -51,6 +51,7 @@ class QQnxNativeInterface : public QPlatformNativeInterface public: void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen); + void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context); void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); };