summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-06-23 15:37:37 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-06-23 15:40:42 +0200
commit8ab2f3d9bdf1119cc13567c9dd2c74879c0b0ee4 (patch)
treee3e0ef844725d8b9d79626b98a60cd94a20ebcda /src/plugins/platforms/xcb
parent90ac74c771b55dd6f8a9700e28278be446d8dd0d (diff)
Get declarative and wayland EGL backend working for Qt compositor.
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp25
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h4
2 files changed, 24 insertions, 5 deletions
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 45823fcc57..28b62b3aec 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -73,6 +73,21 @@ public:
Q_GLOBAL_STATIC(QXcbResourceMap, qXcbResourceMap)
+void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceString, QGuiGLContext *context)
+{
+ QByteArray lowerCaseResource = resourceString.toLower();
+ ResourceType resource = qXcbResourceMap()->value(lowerCaseResource);
+ void *result = 0;
+ switch(resource) {
+ case EglContext:
+ result = eglContextForContext(context);
+ break;
+ default:
+ result = 0;
+ }
+ return result;
+}
+
void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
{
QByteArray lowerCaseResource = resourceString.toLower();
@@ -94,9 +109,6 @@ void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceStr
case GraphicsDevice:
result = graphicsDeviceForWindow(window);
break;
- case EglContext:
- result = eglContextForWindow(window);
- break;
default:
result = 0;
}
@@ -161,8 +173,13 @@ void *QXcbNativeInterface::graphicsDeviceForWindow(QWindow *window)
}
-void * QXcbNativeInterface::eglContextForWindow(QWindow *window)
+void * QXcbNativeInterface::eglContextForContext(QGuiGLContext *context)
{
+ Q_ASSERT(context);
+#if defined(XCB_USE_EGL)
+ QEGLPlatformContext *eglPlatformContext = static_cast<QEGLPlatformContext *>(context->handle());
+ return eglPlatformContext->eglContext();
+#endif
#if 0
Q_ASSERT(window);
QPlatformGLContext *platformContext = window->glContext()->handle();
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index 10e3f6350c..e9b1df4511 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -59,6 +59,7 @@ public:
EglContext
};
+ void *nativeResourceForContext(const QByteArray &resourceString, QGuiGLContext *context);
void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window);
void *displayForWindow(QWindow *window);
@@ -66,7 +67,8 @@ public:
void *connectionForWindow(QWindow *window);
void *screenForWindow(QWindow *window);
void *graphicsDeviceForWindow(QWindow *window);
- void *eglContextForWindow(QWindow *window);
+
+ void *eglContextForContext(QGuiGLContext *context);
private:
static QXcbScreen *qPlatformScreenForWindow(QWindow *window);