Fix the egl path for xcb and wayland plugins
authorJørgen Lind <jorgen.lind@nokia.com>
Tue, 31 May 2011 13:47:02 +0000 (15:47 +0200)
committerJørgen Lind <jorgen.lind@nokia.com>
Tue, 31 May 2011 13:57:03 +0000 (15:57 +0200)
Reviewed-by: Samuel Rødal
src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp
src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h
src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp
src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h
src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp
src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h
src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp
src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h

index a3a8688..8769752 100644 (file)
 
 #include "../../../eglconvenience/qeglconvenience.h"
 
+#include <QtCore/QDebug>
+#include <QtGui/QWindowContext>
+
 #include <QtOpenGL/QGLContext>
 #include <QtOpenGL/private/qglextensions_p.h>
 
 #include "qwaylandshmsurface.h"
 
-#include <QtCore/QDebug>
 
 static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type)
 {
@@ -77,7 +79,7 @@ QWaylandReadbackEglContext::QWaylandReadbackEglContext(QWaylandReadbackEglIntegr
     , mWindow(window)
     , mBuffer(0)
     , mPixmap(0)
-    , mConfig(q_configFromQPlatformWindowFormat(eglIntegration->eglDisplay(),window->widget()->platformWindowFormat(),true,EGL_PIXMAP_BIT))
+    , mConfig(q_configFromQWindowFormat(eglIntegration->eglDisplay(),window->window()->requestedWindowFormat(),true,EGL_PIXMAP_BIT))
     , mPixmapSurface(EGL_NO_SURFACE)
 {
     QVector<EGLint> eglContextAttrs;
@@ -112,7 +114,7 @@ void QWaylandReadbackEglContext::swapBuffers()
 {
     eglSwapBuffers(mEglIntegration->eglDisplay(),mPixmapSurface);
 
-    if (QWindowContext::currentContext().handle() != this) {
+    if (QWindowContext::currentContext()->handle() != this) {
         makeCurrent();
     }
 
@@ -141,7 +143,7 @@ void * QWaylandReadbackEglContext::getProcAddress(const QString &procName)
     return (void *) eglGetProcAddress(procName.toLatin1().data());
 }
 
-QPlatformWindowFormat QWaylandReadbackEglContext::platformWindowFormat() const
+QWindowFormat QWaylandReadbackEglContext::windowFormat() const
 {
     return q_windowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig);
 }
index 4a71ef0..f57ac46 100644 (file)
@@ -60,7 +60,7 @@ public:
     void swapBuffers();
     void* getProcAddress(const QString& procName);
 
-    virtual QPlatformWindowFormat platformWindowFormat() const;
+    virtual QWindowFormat windowFormat() const;
 
     void geometryChanged();
 
index b776713..50a1170 100644 (file)
@@ -83,7 +83,7 @@ void QWaylandReadbackEglIntegration::initialize()
 
 QWaylandWindow * QWaylandReadbackEglIntegration::createEglWindow(QWindow *window)
 {
-    return new QWaylandReadbackEglWindow(widget,this);
+    return new QWaylandReadbackEglWindow(window,this);
 }
 
 EGLDisplay QWaylandReadbackEglIntegration::eglDisplay()
index 90d4aa5..4a085ae 100644 (file)
@@ -44,6 +44,8 @@
 #include "qwaylandscreen.h"
 #include "qwaylandglcontext.h"
 
+#include <QtGui/QWindow>
+
 QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
     : QWaylandWindow(window)
     , mGLContext(0)
@@ -83,7 +85,7 @@ QPlatformGLContext * QWaylandEglWindow::glContext() const
 {
     if (!mGLContext) {
         QWaylandEglWindow *that = const_cast<QWaylandEglWindow *>(this);
-        that->mGLContext = new QWaylandGLContext(mEglIntegration->eglDisplay(),widget()->platformWindowFormat());
+        that->mGLContext = new QWaylandGLContext(mEglIntegration->eglDisplay(),this->window()->requestedWindowFormat());
 
         EGLNativeWindowType window(reinterpret_cast<EGLNativeWindowType>(mWaylandEglWindow));
         EGLSurface surface = eglCreateWindowSurface(mEglIntegration->eglDisplay(),mGLContext->eglConfig(),window,NULL);
@@ -98,7 +100,7 @@ void QWaylandEglWindow::newSurfaceCreated()
     if (mWaylandEglWindow) {
         wl_egl_window_destroy(mWaylandEglWindow);
     }
-    wl_visual *visual = QWaylandScreen::waylandScreenFromWidget(widget())->visual();
+    wl_visual *visual = QWaylandScreen::waylandScreenFromWindow(window())->visual();
     QSize size = geometry().size();
     if (!size.isValid())
         size = QSize(0,0);
index 172722d..0cff704 100644 (file)
 #include "../../../eglconvenience/qeglconvenience.h"
 
 #include <QtGui/QPlatformGLContext>
-#include <QtGui/QPlatformWindowFormat>
+#include <QtGui/QWindowFormat>
 #include <QtCore/QMutex>
 
-QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QPlatformWindowFormat &format)
+QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QWindowFormat &format)
     : QPlatformGLContext()
     , mEglDisplay(eglDisplay)
     , mSurface(EGL_NO_SURFACE)
-    , mConfig(q_configFromQPlatformWindowFormat(mEglDisplay,format,true))
+    , mConfig(q_configFromQWindowFormat(mEglDisplay,format,true))
     , mFormat(q_windowFormatFromConfig(mEglDisplay,mConfig))
 {
-    QPlatformGLContext *sharePlatformContext = 0;
-    sharePlatformContext = format.sharedGLContext();
-    mFormat.setSharedContext(sharePlatformContext);
     EGLContext shareEGLContext = EGL_NO_CONTEXT;
-    if (sharePlatformContext)
-        shareEGLContext = static_cast<const QWaylandGLContext*>(sharePlatformContext)->mContext;
 
     eglBindAPI(EGL_OPENGL_ES_API);
 
index 2c6feb4..47070f5 100644 (file)
@@ -53,14 +53,14 @@ class QWaylandGLWindowSurface;
 
 class QWaylandGLContext : public QPlatformGLContext {
 public:
-    QWaylandGLContext(EGLDisplay eglDisplay, const QPlatformWindowFormat &format);
+    QWaylandGLContext(EGLDisplay eglDisplay, const QWindowFormat &format);
     ~QWaylandGLContext();
     void makeCurrent();
     void doneCurrent();
     void swapBuffers();
     void* getProcAddress(const QString&);
 
-    QPlatformWindowFormat platformWindowFormat() const { return mFormat; }
+    QWindowFormat windowFormat() const { return mFormat; }
 
     void setEglSurface(EGLSurface surface);
     EGLConfig eglConfig() const;
@@ -70,7 +70,7 @@ private:
     EGLContext mContext;
     EGLSurface mSurface;
     EGLConfig mConfig;
-    QPlatformWindowFormat mFormat;
+    QWindowFormat mFormat;
 
     QWaylandGLContext();
 
index 7cdd2b8..e61ee69 100644 (file)
@@ -46,6 +46,7 @@
 
 #include "wayland-xcomposite-client-protocol.h"
 #include <QtCore/QDebug>
+#include <QtGui/QRegion>
 
 #include "qeglconvenience.h"
 #include "qxlibeglintegration.h"
@@ -58,7 +59,7 @@ QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(QWaylandXCompositeEGL
     , mWindow(window)
     , mBuffer(0)
     , mXWindow(0)
-    , mConfig(q_configFromQPlatformWindowFormat(glxIntegration->eglDisplay(),window->widget()->platformWindowFormat(),true,EGL_WINDOW_BIT))
+    , mConfig(q_configFromQWindowFormat(glxIntegration->eglDisplay(),window->window()->requestedWindowFormat(),true,EGL_WINDOW_BIT))
     , mWaitingForSync(false)
 {
     QVector<EGLint> eglContextAttrs;
@@ -98,7 +99,7 @@ void * QWaylandXCompositeEGLContext::getProcAddress(const QString &procName)
     return (void *)eglGetProcAddress(qPrintable(procName));
 }
 
-QPlatformWindowFormat QWaylandXCompositeEGLContext::platformWindowFormat() const
+QWindowFormat QWaylandXCompositeEGLContext::windowFormat() const
 {
     return q_windowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig);
 }
index 9d9dd53..528faf0 100644 (file)
@@ -44,8 +44,6 @@
 
 #include <QtGui/QPlatformGLContext>
 
-#include <QtCore/QWaitCondition>
-
 #include "qwaylandbuffer.h"
 #include "qwaylandxcompositeeglintegration.h"
 
@@ -61,7 +59,7 @@ public:
     void swapBuffers();
     void* getProcAddress(const QString& procName);
 
-    QPlatformWindowFormat platformWindowFormat() const;
+    QWindowFormat windowFormat() const;
 
     void geometryChanged();