Make glx wayland backends working.
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Thu, 16 Jun 2011 10:56:00 +0000 (12:56 +0200)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>
Mon, 20 Jun 2011 08:30:30 +0000 (10:30 +0200)
21 files changed:
examples/opengl/hellowindow/hellowindow.cpp
src/gui/kernel/qwindow.cpp
src/plugins/platforms/wayland/gl_integration/gl_integration.pri
src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp [deleted file]
src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h [deleted file]
src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp
src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h
src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp
src/plugins/platforms/wayland/gl_integration/readback_glx/readback_glx.pri
src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp
src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h
src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp
src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp
src/plugins/platforms/wayland/gl_integration/xcomposite_glx/xcomposite_glx.pri
src/plugins/platforms/wayland/main.cpp
src/plugins/platforms/wayland/qwaylanddisplay.cpp
src/plugins/platforms/wayland/qwaylanddisplay.h
src/plugins/platforms/wayland/qwaylandintegration.cpp
src/plugins/platforms/wayland/qwaylandintegration.h
src/plugins/platforms/wayland/qwaylandwindow.cpp
src/plugins/platforms/wayland/wayland.pro

index 50cf8b0..a88fcf1 100644 (file)
@@ -34,9 +34,8 @@ HelloWindow::HelloWindow(Renderer *renderer)
     create();
 
     QTimer *timer = new QTimer(this);
-    timer->start(10);
-
     connect(timer, SIGNAL(timeout()), this, SLOT(render()));
+    timer->start(10);
 
     updateColor();
 }
index 9ba8af2..2996c00 100644 (file)
@@ -101,6 +101,7 @@ void QWindow::create()
             d->platformWindow->setWindowTitle(d->windowTitle);
         if (d->windowState != Qt::WindowNoState)
             d->windowState = d->platformWindow->setWindowState(d->windowState);
+        d->platformWindow->setGeometry(geometry());
 
         QObjectList childObjects = children();
         for (int i = 0; i < childObjects.size(); i ++) {
index d9b5fa9..6652ff5 100644 (file)
@@ -3,12 +3,10 @@ contains(QT_CONFIG, opengl) {
     QT += opengl
 
 HEADERS += \
-    $$PWD/qwaylandglintegration.h \
-    $$PWD/qwaylandglwindowsurface.h
+    $$PWD/qwaylandglintegration.h
 
 SOURCES += \
-    $$PWD/qwaylandglintegration.cpp \
-    $$PWD/qwaylandglwindowsurface.cpp
+    $$PWD/qwaylandglintegration.cpp
 
     QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG)
     contains(QT_CONFIG, opengles2) {
diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp
deleted file mode 100644 (file)
index 1d6e79e..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandglwindowsurface.h"
-
-#include "qwaylanddisplay.h"
-#include "qwaylandwindow.h"
-#include "qwaylandscreen.h"
-
-#include <QtOpenGL/QGLFramebufferObject>
-#include <QtOpenGL/QGLContext>
-#include <QPlatformGLContext>
-
-#include <QtOpenGL/private/qglengineshadermanager_p.h>
-
-QT_BEGIN_NAMESPACE
-
-static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, const QRectF &br)
-{
-#if !defined(QT_OPENGL_ES_2)
-    QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
-#endif
-    const GLenum target = GL_TEXTURE_2D;
-    QRectF src = br.isEmpty()
-        ? QRectF(QPointF(), texSize)
-        : QRectF(QPointF(br.x(), texSize.height() - br.bottom()), br.size());
-
-    if (target == GL_TEXTURE_2D) {
-        qreal width = texSize.width();
-        qreal height = texSize.height();
-
-        src.setLeft(src.left() / width);
-        src.setRight(src.right() / width);
-        src.setTop(src.top() / height);
-        src.setBottom(src.bottom() / height);
-    }
-
-    const GLfloat tx1 = src.left();
-    const GLfloat tx2 = src.right();
-    const GLfloat ty1 = src.top();
-    const GLfloat ty2 = src.bottom();
-
-    GLfloat texCoordArray[4*2] = {
-        tx1, ty2, tx2, ty2, tx2, ty1, tx1, ty1
-    };
-
-    GLfloat vertexArray[4*2];
-    vertexArray[0] = rect.left(); vertexArray[1] = rect.top();
-    vertexArray[2] = rect.right(); vertexArray[3] = rect.top();
-    vertexArray[4] = rect.right(); vertexArray[5] = rect.bottom();
-    vertexArray[6] = rect.left(); vertexArray[7] = rect.bottom();
-
-    glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexArray);
-    glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, texCoordArray);
-
-    glBindTexture(target, tex_id);
-
-    glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
-    glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
-    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-    glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
-    glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR);
-
-    glBindTexture(target, 0);
-}
-
-static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport, const QSize &texSize, const QRect &targetRect, const QRect &sourceRect)
-{
-    glDisable(GL_DEPTH_TEST);
-    glDisable(GL_SCISSOR_TEST);
-    glDisable(GL_BLEND);
-    glViewport(0, 0, viewport.width(), viewport.height());
-
-    QGLShaderProgram *blitProgram =
-        QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram();
-    blitProgram->bind();
-    blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/);
-
-    // The shader manager's blit program does not multiply the
-    // vertices by the pmv matrix, so we need to do the effect
-    // of the orthographic projection here ourselves.
-    QRectF r;
-    qreal w = viewport.width();
-    qreal h = viewport.height();
-    r.setLeft((targetRect.left() / w) * 2.0f - 1.0f);
-    if (targetRect.right() == (viewport.width() - 1))
-        r.setRight(1.0f);
-    else
-        r.setRight((targetRect.right() / w) * 2.0f - 1.0f);
-    r.setBottom((targetRect.top() / h) * 2.0f - 1.0f);
-    if (targetRect.bottom() == (viewport.height() - 1))
-        r.setTop(1.0f);
-    else
-        r.setTop((targetRect.bottom() / w) * 2.0f - 1.0f);
-
-    drawTexture(r, texture, texSize, sourceRect);
-}
-
-QWaylandGLWindowSurface::QWaylandGLWindowSurface(QWindow *window)
-    : QWindowSurface(window)
-    , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display())
-    , mPaintDevice(0)
-    , mContext(0)
-{
-}
-
-QWaylandGLWindowSurface::~QWaylandGLWindowSurface()
-{
-    delete mPaintDevice;
-    delete mContext;
-}
-
-QPaintDevice *QWaylandGLWindowSurface::paintDevice()
-{
-    return mPaintDevice;
-}
-
-QGuiGLContext *QWaylandGLWindowSurface::context() const
-{
-    if (!mContext)
-        const_cast<QGuiGLContext *&>(mContext) = new QGuiGLContext(window()->glFormat());
-    return mContext;
-}
-
-void QWaylandGLWindowSurface::beginPaint(const QRegion &)
-{
-    context()->makeCurrent(window()->glSurface());
-    glClearColor(0, 0, 0, 0);
-    glClear(GL_COLOR_BUFFER_BIT);
-}
-
-void QWaylandGLWindowSurface::flush(QWindow *, const QRegion &region, const QPoint &offset)
-{
-    Q_UNUSED(offset);
-    Q_UNUSED(region);
-
-    if (mPaintDevice->isBound())
-        mPaintDevice->release();
-
-    QRect rect(0,0,size().width(),size().height());
-    QGLContext *ctx = QGLContext::fromGuiGLContext(context());
-    blitTexture(ctx,mPaintDevice->texture(),size(),mPaintDevice->size(),rect,rect);
-    context()->swapBuffers(window()->glSurface());
-}
-
-void QWaylandGLWindowSurface::resize(const QSize &size)
-{
-    QWindowSurface::resize(size);
-    context()->makeCurrent(window()->glSurface());
-    delete mPaintDevice;
-    mPaintDevice = new QGLFramebufferObject(size);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h
deleted file mode 100644 (file)
index 3703869..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDDRMSURFACE_H
-#define QWAYLANDDRMSURFACE_H
-
-#include "qwaylanddisplay.h"
-
-#include <QtGui/private/qwindowsurface_p.h>
-
-class QGLFramebufferObject;
-
-class QWaylandGLWindowSurface : public QWindowSurface
-{
-public:
-    QWaylandGLWindowSurface(QWindow *window);
-    ~QWaylandGLWindowSurface();
-
-    void beginPaint(const QRegion &);
-
-    QPaintDevice *paintDevice();
-    void flush(QWindow *window, const QRegion &region, const QPoint &offset);
-
-    void resize(const QSize &size);
-
-    QGuiGLContext *context() const;
-
-private:
-    QWaylandDisplay *mDisplay;
-    QGLFramebufferObject *mPaintDevice;
-    QGuiGLContext *mContext;
-};
-
-#endif // QWAYLANDDRMSURFACE_H
index 54b7d32..61fd26f 100644 (file)
@@ -113,7 +113,7 @@ void QWaylandReadbackGlxContext::swapBuffers(const QPlatformGLSurface &surface)
 {
     // #### makeCurrent() directly on the platform context doesn't update QGuiGLContext::currentContext()
     if (QGuiGLContext::currentContext()->handle() != this)
-        makeCurrent(surface, surface);
+        makeCurrent(surface);
 
     const QWaylandReadbackGlxSurface &s =
         static_cast<const QWaylandReadbackGlxSurface &>(surface);
@@ -135,6 +135,7 @@ void QWaylandReadbackGlxContext::swapBuffers(const QPlatformGLSurface &surface)
     memcpy(dstBits, constBits, (img.width() * 4) * img.height());
 
     s.window()->damage(QRect(QPoint(), size));
+
     s.window()->waitForFrameSync();
 }
 
index 27a7287..3008c29 100644 (file)
@@ -47,7 +47,7 @@
 
 #include "qwaylandreadbackglxintegration.h"
 
-#include "qglxconvenience.h"
+#include <QtPlatformSupport/private/qglxconvenience_p.h>
 
 class QWaylandReadbackGlxWindow;
 class QWaylandShmBuffer;
index f878bef..5565e78 100644 (file)
@@ -86,6 +86,11 @@ uchar *QWaylandReadbackGlxWindow::buffer()
     return m_buffer->image()->bits();
 }
 
+QPlatformGLSurface *QWaylandReadbackGlxWindow::createGLSurface() const
+{
+    return new QWaylandReadbackGlxSurface(const_cast<QWaylandReadbackGlxWindow *>(this));
+}
+
 void QWaylandReadbackGlxWindow::createSurface()
 {
     QSize size(geometry().size());
index 5d4cf7a..54d63a2 100644 (file)
@@ -60,8 +60,8 @@ Window QWaylandXCompositeGLXSurface::xWindow() const
 QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(const QGuiGLFormat &format, QPlatformGLContext *share, Display *display, int screen)
     : m_display(display)
 {
+    qDebug("creating XComposite-GLX context");
     GLXContext shareContext = share ? static_cast<QWaylandXCompositeGLXContext *>(share)->m_context : 0;
-
     GLXFBConfig config = qglx_findConfig(display, screen, format);
     XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display, config);
     m_context = glXCreateContext(display, visualInfo, shareContext, true);
index e0de801..39fe030 100644 (file)
@@ -45,7 +45,7 @@
 #include <QtGui/QPlatformGLContext>
 
 #include "qwaylandxcompositeglxintegration.h"
-#include "qglxconvenience.h"
+#include <QtPlatformSupport/private/qglxconvenience_p.h>
 
 class QWaylandXCompositeGLXWindow;
 class QWaylandShmBuffer;
index a80a595..426c78e 100644 (file)
@@ -52,12 +52,15 @@ QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDispl
     return new QWaylandXCompositeGLXIntegration(waylandDisplay);
 }
 
-QWaylandXCompositeGLXIntegration::QWaylandXCompositeGLXIntegration(QWaylandDisplay * waylandDispaly)
-    : QWaylandGLIntegration()
-    , mWaylandDisplay(waylandDispaly)
+QWaylandXCompositeGLXIntegration::QWaylandXCompositeGLXIntegration(QWaylandDisplay *waylandDisplay)
+    : mWaylandDisplay(waylandDisplay)
+    , mWaylandComposite(0)
+    , mDisplay(0)
+    , mScreen(0)
+    , mRootWindow(0)
 {
     qDebug() << "Using XComposite-GLX";
-    wl_display_add_global_listener(waylandDispaly->wl_display(), QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal,
+    wl_display_add_global_listener(waylandDisplay->wl_display(), QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal,
                                    this);
 }
 
@@ -112,6 +115,7 @@ void QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal(wl_display *display
 {
     Q_UNUSED(version);
     if (strcmp(interface, "wl_xcomposite") == 0) {
+        qDebug("XComposite-GLX: got wl_xcomposite global");
         QWaylandXCompositeGLXIntegration *integration = static_cast<QWaylandXCompositeGLXIntegration *>(data);
         integration->mWaylandComposite = wl_xcomposite_create(display,id,1);
         wl_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration);
@@ -124,6 +128,8 @@ void QWaylandXCompositeGLXIntegration::rootInformation(void *data, wl_xcomposite
     Q_UNUSED(xcomposite);
     QWaylandXCompositeGLXIntegration *integration = static_cast<QWaylandXCompositeGLXIntegration *>(data);
 
+    qDebug("XComposite-GLX: xcomposite listener callback");
+
     integration->mDisplay = XOpenDisplay(display_name);
     integration->mRootWindow = (Window) root_window;
     integration->mScreen = XDefaultScreen(integration->mDisplay);
index 41a14e3..797803f 100644 (file)
@@ -112,6 +112,11 @@ void QWaylandXCompositeGLXWindow::createSurface()
         size = QSize(1,1);
     }
 
+    if (!m_glxIntegration->xDisplay()) {
+        qWarning("XCompositeGLXWindow: X display still null?!");
+        return;
+    }
+
     XVisualInfo *visualInfo = glXGetVisualFromFBConfig(m_glxIntegration->xDisplay(), m_config);
     Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),
             visualInfo->visual, AllocNone);
index ba365ca..e4d420d 100644 (file)
@@ -54,8 +54,7 @@ public:
 QStringList QWaylandIntegrationPlugin::keys() const
 {
     QStringList list;
-    list << "Wayland";
-    list << "WaylandGL";
+    list << "wayland";
     return list;
 }
 
@@ -63,9 +62,7 @@ QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, c
 {
     Q_UNUSED(paramList);
     if (system.toLower() == "wayland")
-        return new QWaylandIntegration;
-    if (system.toLower() == "waylandgl")
-        return new QWaylandIntegration(true);
+        return new QWaylandIntegration();
 
     return 0;
 }
index f1c9ccc..324f9dc 100644 (file)
@@ -47,9 +47,7 @@
 #include "qwaylandinputdevice.h"
 #include "qwaylandclipboard.h"
 
-#ifdef QT_WAYLAND_GL_SUPPORT
 #include "gl_integration/qwaylandglintegration.h"
-#endif
 
 #ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
 #include "windowmanager_integration/qwaylandwindowmanagerintegration.h"
@@ -93,12 +91,10 @@ struct wl_visual *QWaylandDisplay::argbPremultipliedVisual()
     return premultiplied_argb_visual;
 }
 
-#ifdef QT_WAYLAND_GL_SUPPORT
 QWaylandGLIntegration * QWaylandDisplay::eglIntegration()
 {
     return mEglIntegration;
 }
-#endif
 
 #ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
 QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration()
@@ -136,9 +132,7 @@ QWaylandDisplay::QWaylandDisplay(void)
 
     wl_display_add_global_listener(mDisplay, QWaylandDisplay::displayHandleGlobal, this);
 
-#ifdef QT_WAYLAND_GL_SUPPORT
     mEglIntegration = QWaylandGLIntegration::createGLIntegration(this);
-#endif
 
 #ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
     mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this);
@@ -148,9 +142,7 @@ QWaylandDisplay::QWaylandDisplay(void)
 
     qRegisterMetaType<uint32_t>("uint32_t");
 
-#ifdef QT_WAYLAND_GL_SUPPORT
     mEglIntegration->initialize();
-#endif
 
     connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), this, SLOT(flushRequests()));
 
@@ -165,9 +157,7 @@ QWaylandDisplay::QWaylandDisplay(void)
 QWaylandDisplay::~QWaylandDisplay(void)
 {
     close(mFd);
-#ifdef QT_WAYLAND_GL_SUPPORT
     delete mEglIntegration;
-#endif
     wl_display_destroy(mDisplay);
 }
 
@@ -290,6 +280,8 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id,
         mInputDevices.append(inputDevice);
     } else if (interface == "wl_selection_offer") {
         QPlatformIntegration *plat = QGuiApplicationPrivate::platformIntegration();
+        if (!plat)
+            return;
         QWaylandClipboard *clipboard = static_cast<QWaylandClipboard *>(plat->clipboard());
         clipboard->createSelectionOffer(id);
     }
index 765be62..2c31687 100644 (file)
@@ -73,9 +73,7 @@ public:
     struct wl_visual *argbVisual();
     struct wl_visual *argbPremultipliedVisual();
 
-#ifdef QT_WAYLAND_GL_SUPPORT
     QWaylandGLIntegration *eglIntegration();
-#endif
 
 #ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
     QWaylandWindowManagerIntegration *windowManagerIntegration();
@@ -133,9 +131,8 @@ private:
     static void handleVisual(void *data,
                                        struct wl_compositor *compositor,
                                        uint32_t id, uint32_t token);
-#ifdef QT_WAYLAND_GL_SUPPORT
+
     QWaylandGLIntegration *mEglIntegration;
-#endif
 
 #ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
     QWaylandWindowManagerIntegration *mWindowManagerIntegration;
index 4c2eaa6..4edcfc4 100644 (file)
 #include <QtGui/QGuiGLFormat>
 
 #include <QtGui/private/qpixmap_raster_p.h>
-#ifdef QT_WAYLAND_GL_SUPPORT
+
 #include "gl_integration/qwaylandglintegration.h"
-#include "gl_integration/qwaylandglwindowsurface.h"
-#include <QtOpenGL/private/qpixmapdata_gl_p.h>
-#endif
 
-QWaylandIntegration::QWaylandIntegration(bool useOpenGL)
+QWaylandIntegration::QWaylandIntegration()
     : mFontDb(new QGenericUnixFontDatabase())
     , mDisplay(new QWaylandDisplay())
-    , mUseOpenGL(useOpenGL)
     , mNativeInterface(new QWaylandNativeInterface)
     , mClipboard(0)
 {
@@ -84,46 +80,32 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co
 {
     switch (cap) {
     case ThreadedPixmaps: return true;
-    case OpenGL: return hasOpenGL();
+    case OpenGL: return true;
     default: return QPlatformIntegration::hasCapability(cap);
     }
 }
 
 QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) const
 {
-#ifdef QT_WAYLAND_GL_SUPPORT
-    if (mUseOpenGL)
-        return new QGLPixmapData(type);
-#endif
     return new QRasterPixmapData(type);
 }
 
 QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const
 {
-#ifdef QT_WAYLAND_GL_SUPPORT
-    bool useOpenGL = mUseOpenGL || window->surfaceType() == QWindow::OpenGLSurface;
-    if (useOpenGL)
+    if (window->surfaceType() == QWindow::OpenGLSurface)
         return mDisplay->eglIntegration()->createEglWindow(window);
-#endif
+
     return new QWaylandShmWindow(window);
 }
 
 QPlatformGLContext *QWaylandIntegration::createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const
 {
-#ifdef QT_WAYLAND_GL_SUPPORT
     return mDisplay->eglIntegration()->createPlatformGLContext(glFormat, share);
-#endif
-    return 0;
 }
 
 QWindowSurface *QWaylandIntegration::createWindowSurface(QWindow *window, WId winId) const
 {
     Q_UNUSED(winId);
-#ifdef QT_WAYLAND_GL_SUPPORT
-    bool useOpenGL = mUseOpenGL || window->surfaceType() == QWindow::OpenGLSurface;
-    if (useOpenGL)
-        return new QWaylandGLWindowSurface(window);
-#endif
     return new QWaylandShmWindowSurface(window);
 }
 
@@ -132,15 +114,6 @@ QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const
     return mFontDb;
 }
 
-bool QWaylandIntegration::hasOpenGL() const
-{
-#ifdef QT_WAYLAND_GL_SUPPORT
-    return true;
-#else
-    return false;
-#endif
-}
-
 QPlatformClipboard *QWaylandIntegration::clipboard() const
 {
     if (!mClipboard)
index 2e05faf..e55dec3 100644 (file)
@@ -52,7 +52,7 @@ class QWaylandDisplay;
 class QWaylandIntegration : public QPlatformIntegration
 {
 public:
-    QWaylandIntegration(bool useOpenGL = false);
+    QWaylandIntegration();
 
     bool hasCapability(QPlatformIntegration::Capability cap) const;
     QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
@@ -69,11 +69,8 @@ public:
     QPlatformClipboard *clipboard() const;
 
 private:
-    bool hasOpenGL() const;
-
     QPlatformFontDatabase *mFontDb;
     QWaylandDisplay *mDisplay;
-    bool mUseOpenGL;
     QPlatformNativeInterface *mNativeInterface;
     mutable QPlatformClipboard *mClipboard;
 };
index 53f74e3..ec62a3c 100644 (file)
@@ -116,8 +116,8 @@ void QWaylandWindow::configure(uint32_t time, uint32_t edges,
 {
     Q_UNUSED(time);
     Q_UNUSED(edges);
-    QRect geometry = QRect(x, y, width, height);
 
+    QRect geometry = QRect(x, y, width, height);
     setGeometry(geometry);
 
     QWindowSystemInterface::handleGeometryChange(window(), geometry);
index 6a6ffdf..0a2084d 100644 (file)
@@ -40,3 +40,5 @@ QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND
 target.path += $$[QT_INSTALL_PLUGINS]/platforms
 INSTALLS += target
 
+include ($$PWD/gl_integration/gl_integration.pri)
+include ($$PWD/windowmanager_integration/windowmanager_integration.pri)