From ab30cabb6383413ee3b2913615d75082c0c55686 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 21 Nov 2013 13:43:23 +0100 Subject: Rename QWaylandGLIntegration to QWaylandClientBufferIntegration also add a factory to load QWaylandClientBufferIntegrationPlugins Change-Id: Ia6a03627659b0452439ae664fceef21eaf0f6de0 Reviewed-by: Andy Nichols --- src/client/client.pro | 5 +- .../hardwareintegration/hardwareintegration.pri | 10 +++ .../qwaylandclientbufferintegration.cpp | 56 +++++++++++++ .../qwaylandclientbufferintegration.h | 76 +++++++++++++++++ .../qwaylandclientbufferintegrationfactory.cpp | 96 ++++++++++++++++++++++ .../qwaylandclientbufferintegrationfactory.h | 61 ++++++++++++++ .../qwaylandclientbufferintegrationplugin.cpp | 55 +++++++++++++ .../qwaylandclientbufferintegrationplugin.h | 69 ++++++++++++++++ src/client/qwaylanddisplay.cpp | 6 +- src/client/qwaylanddisplay.h | 4 +- src/client/qwaylandglintegration.cpp | 56 ------------- src/client/qwaylandglintegration.h | 76 ----------------- src/client/qwaylandintegration.cpp | 43 +++++++--- src/client/qwaylandintegration.h | 8 +- 14 files changed, 466 insertions(+), 155 deletions(-) create mode 100644 src/client/hardwareintegration/hardwareintegration.pri create mode 100644 src/client/hardwareintegration/qwaylandclientbufferintegration.cpp create mode 100644 src/client/hardwareintegration/qwaylandclientbufferintegration.h create mode 100644 src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp create mode 100644 src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.h create mode 100644 src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp create mode 100644 src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.h delete mode 100644 src/client/qwaylandglintegration.cpp delete mode 100644 src/client/qwaylandglintegration.h (limited to 'src/client') diff --git a/src/client/client.pro b/src/client/client.pro index 7aac1d1b6..152370c0b 100644 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -95,7 +95,4 @@ HEADERS += qwaylandintegration.h \ qwaylandinputcontext.h \ qwaylanddatadevice.h \ -contains(DEFINES, QT_WAYLAND_GL_SUPPORT) { - SOURCES += qwaylandglintegration.cpp - HEADERS += qwaylandglintegration.h -} +include(hardwareintegration/hardwareintegration.pri) diff --git a/src/client/hardwareintegration/hardwareintegration.pri b/src/client/hardwareintegration/hardwareintegration.pri new file mode 100644 index 000000000..2ed95368f --- /dev/null +++ b/src/client/hardwareintegration/hardwareintegration.pri @@ -0,0 +1,10 @@ +SOURCES += \ + $$PWD/qwaylandclientbufferintegration.cpp \ + $$PWD/qwaylandclientbufferintegrationplugin.cpp \ + $$PWD/qwaylandclientbufferintegrationfactory.cpp + +HEADERS += \ + $$PWD/qwaylandclientbufferintegration.h \ + $$PWD/qwaylandclientbufferintegrationplugin.h \ + $$PWD/qwaylandclientbufferintegrationfactory.h + diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegration.cpp b/src/client/hardwareintegration/qwaylandclientbufferintegration.cpp new file mode 100644 index 000000000..c04ee1772 --- /dev/null +++ b/src/client/hardwareintegration/qwaylandclientbufferintegration.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandclientbufferintegration.h" + +QT_BEGIN_NAMESPACE + +QWaylandClientBufferIntegration::QWaylandClientBufferIntegration() +{ + +} + +QWaylandClientBufferIntegration::~QWaylandClientBufferIntegration() +{ + +} + +QT_END_NAMESPACE diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegration.h b/src/client/hardwareintegration/qwaylandclientbufferintegration.h new file mode 100644 index 000000000..12468537e --- /dev/null +++ b/src/client/hardwareintegration/qwaylandclientbufferintegration.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTBUFFERINTEGRATION_H +#define QWAYLANDCLIENTBUFFERINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandDisplay; +class QWindow; + +class QPlatformOpenGLContext; +class QSurfaceFormat; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegration +{ +public: + QWaylandClientBufferIntegration(); + virtual ~QWaylandClientBufferIntegration(); + + virtual void initialize() = 0; + virtual bool waitingForEvents() { return false; } + + virtual bool supportsThreadedOpenGL() const { return false; } + + virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; + virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0; + + static QWaylandClientBufferIntegration *createGLIntegration(QWaylandDisplay *waylandDisplay); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDCLIENTBUFFERINTEGRATION_H diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp new file mode 100644 index 000000000..c87c016f5 --- /dev/null +++ b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandclientbufferintegrationfactory.h" +#include "qwaylandclientbufferintegrationplugin.h" +#include "qwaylandclientbufferintegration.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_LIBRARY +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String("/wayland-graphics-integration/client"), Qt::CaseInsensitive)) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, + (QWaylandClientBufferIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) +#endif + +QStringList QWaylandClientBufferIntegrationFactory::keys(const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + QStringList list; + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + list = directLoader()->keyMap().values(); + if (!list.isEmpty()) { + const QString postFix = QStringLiteral(" (from ") + + QDir::toNativeSeparators(pluginPath) + + QLatin1Char(')'); + const QStringList::iterator end = list.end(); + for (QStringList::iterator it = list.begin(); it != end; ++it) + (*it).append(postFix); + } + } + list.append(loader()->keyMap().values()); + return list; +#else + return QStringList(); +#endif +} + +QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +{ +#ifndef QT_NO_LIBRARY + // Try loading the plugin from platformPluginPath first: + if (!pluginPath.isEmpty()) { + QCoreApplication::addLibraryPath(pluginPath); + if (QWaylandClientBufferIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + return ret; + } + if (QWaylandClientBufferIntegration *ret = qLoadPlugin1(loader(), name, args)) + return ret; +#endif + return 0; +} + +QT_END_NAMESPACE diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.h b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.h new file mode 100644 index 000000000..12b2e8dbb --- /dev/null +++ b/src/client/hardwareintegration/qwaylandclientbufferintegrationfactory.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H +#define QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandClientBufferIntegration; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationFactory +{ +public: + static QStringList keys(const QString &pluginPath = QString()); + static QWaylandClientBufferIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDCLIENTBUFFERINTEGRATIONFACTORY_H diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp b/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp new file mode 100644 index 000000000..58bb26d19 --- /dev/null +++ b/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandclientbufferintegrationplugin.h" + +QT_BEGIN_NAMESPACE + +QWaylandClientBufferIntegrationPlugin::QWaylandClientBufferIntegrationPlugin(QObject *parent) : + QObject(parent) +{ +} + +QWaylandClientBufferIntegrationPlugin::~QWaylandClientBufferIntegrationPlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.h b/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.h new file mode 100644 index 000000000..685844061 --- /dev/null +++ b/src/client/hardwareintegration/qwaylandclientbufferintegrationplugin.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H +#define QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QWaylandClientBufferIntegration; + +#define QWaylandClientBufferIntegrationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" + +class Q_WAYLAND_CLIENT_EXPORT QWaylandClientBufferIntegrationPlugin : public QObject +{ + Q_OBJECT +public: + explicit QWaylandClientBufferIntegrationPlugin(QObject *parent = 0); + ~QWaylandClientBufferIntegrationPlugin(); + + virtual QWaylandClientBufferIntegration *create(const QString &key, const QStringList ¶mList) = 0; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDCLIENTBUFFERINTEGRATIONPLUGIN_H diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 4bcf2f689..880c76df8 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -50,7 +50,7 @@ #include "qwaylandclipboard.h" #include "qwaylanddatadevicemanager.h" -#include "qwaylandglintegration.h" +#include "qwaylandclientbufferintegration.h" #include "qwaylandwindowmanagerintegration.h" @@ -78,9 +78,9 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle) return surface; } -QWaylandGLIntegration * QWaylandDisplay::glIntegration() const +QWaylandClientBufferIntegration * QWaylandDisplay::clientBufferIntegration() const { - return mWaylandIntegration->glIntegration(); + return mWaylandIntegration->clientBufferIntegration(); } QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() const diff --git a/src/client/qwaylanddisplay.h b/src/client/qwaylanddisplay.h index c58a45f5d..4e76de256 100644 --- a/src/client/qwaylanddisplay.h +++ b/src/client/qwaylanddisplay.h @@ -62,7 +62,7 @@ class QSocketNotifier; class QWaylandBuffer; class QPlatformScreen; class QWaylandScreen; -class QWaylandGLIntegration; +class QWaylandClientBufferIntegration; class QWaylandWindowManagerIntegration; class QWaylandDataDeviceManager; class QWaylandTouchExtension; @@ -98,7 +98,7 @@ public: struct wl_surface *createSurface(void *handle); - QWaylandGLIntegration *glIntegration() const; + QWaylandClientBufferIntegration *clientBufferIntegration() const; QWaylandWindowManagerIntegration *windowManagerIntegration() const; diff --git a/src/client/qwaylandglintegration.cpp b/src/client/qwaylandglintegration.cpp deleted file mode 100644 index bafb99443..000000000 --- a/src/client/qwaylandglintegration.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandglintegration.h" - -QT_BEGIN_NAMESPACE - -QWaylandGLIntegration::QWaylandGLIntegration() -{ - -} - -QWaylandGLIntegration::~QWaylandGLIntegration() -{ - -} - -QT_END_NAMESPACE diff --git a/src/client/qwaylandglintegration.h b/src/client/qwaylandglintegration.h deleted file mode 100644 index 7697d3103..000000000 --- a/src/client/qwaylandglintegration.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, 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, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDGLINTEGRATION_H -#define QWAYLANDGLINTEGRATION_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QWaylandWindow; -class QWaylandDisplay; -class QWindow; - -class QPlatformOpenGLContext; -class QSurfaceFormat; - -class Q_WAYLAND_CLIENT_EXPORT QWaylandGLIntegration -{ -public: - QWaylandGLIntegration(); - virtual ~QWaylandGLIntegration(); - - virtual void initialize() = 0; - virtual bool waitingForEvents() { return false; } - - virtual bool supportsThreadedOpenGL() const { return false; } - - virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; - virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0; - - static QWaylandGLIntegration *createGLIntegration(QWaylandDisplay *waylandDisplay); -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDGLINTEGRATION_H diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index af4c4f7d4..3c0c12e4f 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -65,9 +65,8 @@ #include #include -#ifdef QT_WAYLAND_GL_SUPPORT -#include "qwaylandglintegration.h" -#endif +#include "qwaylandclientbufferintegration.h" +#include "qwaylandclientbufferintegrationfactory.h" QT_BEGIN_NAMESPACE @@ -102,13 +101,15 @@ public: }; QWaylandIntegration::QWaylandIntegration() - : mFontDb(new QGenericUnixFontDatabase()) + : mClientBufferIntegration(0) + , mFontDb(new QGenericUnixFontDatabase()) , mNativeInterface(new QWaylandNativeInterface(this)) #ifndef QT_NO_ACCESSIBILITY , mAccessibility(new QPlatformAccessibility()) #else , mAccessibility(0) #endif + , mClientBufferIntegrationInitialized(false) { mDisplay = new QWaylandDisplay(this); mClipboard = new QWaylandClipboard(mDisplay); @@ -141,9 +142,9 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co switch (cap) { case ThreadedPixmaps: return true; case OpenGL: - return mDisplay->glIntegration(); + return mDisplay->clientBufferIntegration(); case ThreadedOpenGL: - return mDisplay->glIntegration() && mDisplay->glIntegration()->supportsThreadedOpenGL(); + return mDisplay->clientBufferIntegration() && mDisplay->clientBufferIntegration()->supportsThreadedOpenGL(); case BufferQueueingOpenGL: return true; case MultipleWindows: @@ -155,15 +156,15 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const { - if (window->surfaceType() == QWindow::OpenGLSurface && mDisplay->glIntegration()) - return mDisplay->glIntegration()->createEglWindow(window); + if (window->surfaceType() == QWindow::OpenGLSurface && mDisplay->clientBufferIntegration()) + return mDisplay->clientBufferIntegration()->createEglWindow(window); return new QWaylandShmWindow(window); } QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { - if (mDisplay->glIntegration()) - return mDisplay->glIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); + if (mDisplay->clientBufferIntegration()) + return mDisplay->clientBufferIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); return 0; } @@ -236,9 +237,27 @@ QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) co return GenericWaylandTheme::createUnixTheme(name); } -QWaylandGLIntegration *QWaylandIntegration::glIntegration() const +QWaylandClientBufferIntegration *QWaylandIntegration::clientBufferIntegration() const { - return 0; + if (!mClientBufferIntegrationInitialized) + const_cast(this)->initializeBufferIntegration(); + + return mClientBufferIntegration; +} + +void QWaylandIntegration::initializeBufferIntegration() +{ + mClientBufferIntegrationInitialized = true; + + QByteArray clientBufferIntegrationName = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"); + if (clientBufferIntegrationName.isEmpty()) + clientBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + + QStringList keys = QWaylandClientBufferIntegrationFactory::keys(); + QString targetKey = QString::fromLocal8Bit(clientBufferIntegrationName); + if (keys.contains(targetKey)) { + mClientBufferIntegration = QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()); + } } QT_END_NAMESPACE diff --git a/src/client/qwaylandintegration.h b/src/client/qwaylandintegration.h index ebda9b284..bbc3c928a 100644 --- a/src/client/qwaylandintegration.h +++ b/src/client/qwaylandintegration.h @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE class QWaylandBuffer; class QWaylandDisplay; -class QWaylandGLIntegration; +class QWaylandClientBufferIntegration; class Q_WAYLAND_CLIENT_EXPORT QWaylandIntegration : public QPlatformIntegration { @@ -87,8 +87,11 @@ public: QPlatformTheme *createPlatformTheme(const QString &name) const; - virtual QWaylandGLIntegration *glIntegration() const; + virtual QWaylandClientBufferIntegration *clientBufferIntegration() const; +protected: + QWaylandClientBufferIntegration *mClientBufferIntegration; private: + void initializeBufferIntegration(); QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; QPlatformDrag *mDrag; @@ -96,6 +99,7 @@ private: QPlatformNativeInterface *mNativeInterface; QScopedPointer mInputContext; QPlatformAccessibility *mAccessibility; + bool mClientBufferIntegrationInitialized; }; QT_END_NAMESPACE -- cgit v1.2.3