summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZeno Albisser <zeno@webkit.org>2012-10-24 16:04:15 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-26 12:09:28 +0200
commit9214b39beb01d69d3667328e7e62ef8d779b3957 (patch)
tree888e59e86375a3fc420361c81ed879e0e776c84c
parent03967c4f0b5dbbd134da676846a20f6e5b9a2554 (diff)
Add glxContextForContext function to QXcbNativeInterface.
This change enables receiving the native GLXContext object that is used by a QOpenGLContext in case of GLX. This clearly is non-public api that is only meant to be used as a last resort for cases where it is really necessary to get hold of a native context object. Change-Id: I7f1f974f18063ed334b8034a0c0192c875c10cec Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp19
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h4
2 files changed, 22 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 2a36fb7369..fa5f5f43d0 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -53,6 +53,8 @@
#if defined(XCB_USE_EGL)
#include "QtPlatformSupport/private/qeglplatformcontext_p.h"
+#elif defined (XCB_USE_GLX)
+#include "qglxintegration.h"
#endif
QT_BEGIN_NAMESPACE
@@ -68,6 +70,7 @@ public:
insert("connection",QXcbNativeInterface::Connection);
insert("screen",QXcbNativeInterface::Screen);
insert("eglcontext",QXcbNativeInterface::EglContext);
+ insert("glxcontext",QXcbNativeInterface::GLXContext);
}
};
@@ -91,6 +94,9 @@ void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceSt
case EglContext:
result = eglContextForContext(context);
break;
+ case GLXContext:
+ result = glxContextForContext(context);
+ break;
default:
break;
}
@@ -191,4 +197,17 @@ void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context)
#endif
}
+void *QXcbNativeInterface::glxContextForContext(QOpenGLContext *context)
+{
+ Q_ASSERT(context);
+#if defined(XCB_USE_GLX)
+ QGLXContext *glxPlatformContext = static_cast<QGLXContext *>(context->handle());
+ return glxPlatformContext->glxContext();
+#else
+ Q_UNUSED(context);
+ return 0;
+#endif
+
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index 1223fdc39c..c15d00255a 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -58,7 +58,8 @@ public:
Connection,
Screen,
GraphicsDevice,
- EglContext
+ EglContext,
+ GLXContext
};
QXcbNativeInterface();
@@ -76,6 +77,7 @@ public:
void *screenForWindow(QWindow *window);
void *graphicsDeviceForWindow(QWindow *window);
static void *eglContextForContext(QOpenGLContext *context);
+ static void *glxContextForContext(QOpenGLContext *context);
private:
const QByteArray m_genericEventFilterType;