diff options
author | Andy Nichols <andy.nichols@digia.com> | 2014-01-09 15:10:43 +0100 |
---|---|---|
committer | Andy Nichols <andy.nichols@digia.com> | 2014-01-09 16:10:23 +0100 |
commit | 1c70431808ca2d0797fda05bb9ee3640bff800bb (patch) | |
tree | 6bbf1333b7da5afea2e163263820d5c40dbc1ea3 /src/plugins | |
parent | 3e02c41cc43a20c8af41730934ae7bbac02ab861 (diff) | |
parent | c9734e76ce03ebba63e34b60b16a9cca3efa3569 (diff) |
Merge remote-tracking branch stable into dev
Conflicts:
.qmake.conf
src/compositor/hardware_integration/qwaylandclientbufferintegrationplugin.h
src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp
src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp
src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp
src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp
src/plugins/platforms/qwayland-brcm-egl/main.cpp
src/plugins/platforms/qwayland-egl/main.cpp
src/plugins/platforms/qwayland-generic/main.cpp
src/plugins/platforms/qwayland-xcomposite-egl/main.cpp
src/plugins/platforms/qwayland-xcomposite-glx/main.cpp
Change-Id: I957c9bee893a9e19fc8c93f0e51292007fb3a4a8
Diffstat (limited to 'src/plugins')
151 files changed, 787 insertions, 12524 deletions
diff --git a/src/plugins/waylandcompositors/brcm-egl/brcm-egl.json b/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.json index 48611c6ab..48611c6ab 100644 --- a/src/plugins/waylandcompositors/brcm-egl/brcm-egl.json +++ b/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.json diff --git a/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro b/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro new file mode 100644 index 000000000..d98b7941b --- /dev/null +++ b/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.pro @@ -0,0 +1,14 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/brcm-egl/brcm-egl.pri) + +LIBS += -lEGL + +OTHER_FILES += \ + brcm-egl.json + +SOURCES += main.cpp + diff --git a/src/plugins/hardwareintegration/client/brcm-egl/main.cpp b/src/plugins/hardwareintegration/client/brcm-egl/main.cpp new file mode 100644 index 000000000..b7f376555 --- /dev/null +++ b/src/plugins/hardwareintegration/client/brcm-egl/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 <QtWaylandClient/qwaylandclientbufferintegrationplugin.h> +#include "qwaylandbrcmeglclientbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class QWaylandBrcmEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "brcm-egl.json") +public: + QStringList keys() const; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList QWaylandBrcmEglClientBufferPlugin::keys() const +{ + QStringList list; + list << "brcm"; + return list; +} + +QWaylandEglClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "brcm") + return new QWaylandBrcmEglClientBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/hardwareintegration/client/client.pro b/src/plugins/hardwareintegration/client/client.pro new file mode 100644 index 000000000..1d79b2634 --- /dev/null +++ b/src/plugins/hardwareintegration/client/client.pro @@ -0,0 +1,19 @@ +TEMPLATE=subdirs + +config_wayland_egl: \ + SUBDIRS += wayland-egl + +config_brcm_egl: \ + SUBDIRS += brcm-egl + +config_xcomposite { + config_egl: \ + SUBDIRS += xcomposite-egl + + !contains(QT_CONFIG, opengles2):config_glx: \ + SUBDIRS += xcomposite-glx +} + +config_drm_egl_server: \ + SUBDIRS += drm-egl-server + diff --git a/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.json b/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.json new file mode 100644 index 000000000..e2266ec60 --- /dev/null +++ b/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "drm-egl-server" ] +} diff --git a/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro b/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro new file mode 100644 index 000000000..d282afc81 --- /dev/null +++ b/src/plugins/hardwareintegration/client/drm-egl-server/drm-egl-server.pro @@ -0,0 +1,14 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/drm-egl-server/drm-egl-server.pri) + +LIBS += -lEGL + +OTHER_FILES += \ + drm-egl-server.json + +SOURCES += main.cpp + diff --git a/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp b/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp new file mode 100644 index 000000000..460ccb7a1 --- /dev/null +++ b/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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 <QtWaylandClient/private/qwaylandserverbufferintegrationplugin_p.h> +#include "drmeglserverbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class DrmEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.1" FILE "drm-egl-server.json") +public: + QStringList keys() const; + QWaylandServerBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList DrmEglServerBufferPlugin::keys() const +{ + QStringList list; + list << "drm-egl-server"; + return list; +} + +QWaylandServerBufferIntegration *DrmEglServerBufferPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "drm-egl-server") + return new DrmEglServerBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/hardwareintegration/client/wayland-egl/main.cpp b/src/plugins/hardwareintegration/client/wayland-egl/main.cpp new file mode 100644 index 000000000..44ce6019d --- /dev/null +++ b/src/plugins/hardwareintegration/client/wayland-egl/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** 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 <QtWaylandClient/private/qwaylandclientbufferintegrationplugin_p.h> +#include "qwaylandeglclientbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class QWaylandEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "wayland-egl.json") +public: + QStringList keys() const; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList QWaylandEglClientBufferPlugin::keys() const +{ + QStringList list; + list << "wayland-egl"; + return list; +} + +QWaylandClientBufferIntegration *QWaylandEglClientBufferPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "wayland-egl") + return new QWaylandEglClientBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/waylandcompositors/wayland-egl/wayland-egl.json b/src/plugins/hardwareintegration/client/wayland-egl/wayland-egl.json index 4ea5bab90..4ea5bab90 100644 --- a/src/plugins/waylandcompositors/wayland-egl/wayland-egl.json +++ b/src/plugins/hardwareintegration/client/wayland-egl/wayland-egl.json diff --git a/src/plugins/hardwareintegration/client/wayland-egl/wayland-egl.pro b/src/plugins/hardwareintegration/client/wayland-egl/wayland-egl.pro new file mode 100644 index 000000000..0eca1d411 --- /dev/null +++ b/src/plugins/hardwareintegration/client/wayland-egl/wayland-egl.pro @@ -0,0 +1,12 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/wayland-egl/wayland-egl.pri) + +OTHER_FILES += \ + wayland-egl.json + +SOURCES += main.cpp + diff --git a/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp b/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp new file mode 100644 index 000000000..7c6135ccc --- /dev/null +++ b/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** 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 <QtWaylandClient/private/qwaylandclientbufferintegrationplugin_p.h> +#include "qwaylandxcompositeeglclientbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "xcomposite-egl.json") +public: + QStringList keys() const; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList QWaylandXCompositeEglClientBufferIntegrationPlugin::keys() const +{ + QStringList list; + list << "xcomposite" << "xcomposite-egl"; + return list; +} + +QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "xcomposite" || system.toLower() == "xcomposite-egl") + return new QWaylandXCompositeEGLClientBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.json b/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json index 8ccd5b46b..8ccd5b46b 100644 --- a/src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.json +++ b/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json diff --git a/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro b/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro new file mode 100644 index 000000000..3129f844b --- /dev/null +++ b/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.pro @@ -0,0 +1,12 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri) + +OTHER_FILES += xcomposite-egl.json + +SOURCES += \ + main.cpp + diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp b/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp new file mode 100644 index 000000000..4beb7e6e3 --- /dev/null +++ b/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** 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 <QtWaylandClient/qwaylandclientbufferintegrationplugin.h> +#include "qwaylandxcompositeglxclientbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.1" FILE "xcomposite-glx.json") +public: + QStringList keys() const; + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList QWaylandXCompositeGlxClientBufferIntegrationPlugin::keys() const +{ + QStringList list; + list << "xcomposite-glx"; + return list; +} + +QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "xcomposite-glx") + return new QWaylandXCompositeGLXClientBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json b/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json new file mode 100644 index 000000000..0f4a3bf69 --- /dev/null +++ b/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "wayland-xcomposite-glx" ] +} diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro b/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro new file mode 100644 index 000000000..3146b3696 --- /dev/null +++ b/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.pro @@ -0,0 +1,12 @@ +PLUGIN_TYPE = wayland-graphics-integration/client +load(qt_plugin) + +QT += waylandclient-private + +include(../../../../hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri) + +OTHER_FILES += xcomposite-glx.json + +SOURCES += \ + main.cpp + diff --git a/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.json b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.json new file mode 100644 index 000000000..48611c6ab --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "wayland-brcm" ] +} diff --git a/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro new file mode 100644 index 000000000..56dc27402 --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.pro @@ -0,0 +1,13 @@ +PLUGIN_TYPE = wayland-graphics-integration/server +load(qt_plugin) + +QT = compositor compositor-private core-private gui-private + +OTHER_FILES += brcm-egl.json + +LIBS += -lEGL + +SOURCES += \ + main.cpp + +include($PWD/../../../../hardwareintegration/compositor/brcm-egl/brcm-egl.pri) diff --git a/src/plugins/waylandcompositors/brcm-egl/main.cpp b/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp index 56fd6da28..bfdfa6432 100644 --- a/src/plugins/waylandcompositors/brcm-egl/main.cpp +++ b/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp @@ -39,28 +39,28 @@ ** ****************************************************************************/ -#include <QtCompositor/qwaylandgraphicshardwareintegrationplugin.h> +#include <QtCompositor/qwaylandclientbufferintegrationplugin.h> #include "brcmeglintegration.h" QT_BEGIN_NAMESPACE -class QWaylandIntegrationPlugin : public QWaylandGraphicsHardwareIntegrationPlugin +class QWaylandBrcmClientBufferIntegration : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.QWaylandGraphicsHardwareIntegrationFactoryInterface.5.3" FILE "brcm-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "brcm-egl.json") public: QStringList keys() const; - QWaylandGraphicsHardwareIntegration *create(const QString&, const QStringList&); + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); }; -QStringList QWaylandIntegrationPlugin::keys() const +QStringList QWaylandBrcmClientBufferIntegration::keys() const { QStringList list; list << "wayland-brcm"; return list; } -QWaylandGraphicsHardwareIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandBrcmClientBufferIntegration::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); if (system.toLower() == "wayland-brcm") diff --git a/src/plugins/hardwareintegration/compositor/compositor.pro b/src/plugins/hardwareintegration/compositor/compositor.pro new file mode 100644 index 000000000..3c1ff5d73 --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/compositor.pro @@ -0,0 +1,17 @@ +TEMPLATE = subdirs + +config_wayland_egl: \ + SUBDIRS += wayland-egl +config_brcm_egl: \ + SUBDIRS += brcm-egl + +config_xcomposite { + config_egl: \ + SUBDIRS += xcomposite-egl + + !contains(QT_CONFIG, opengles2):config_glx: \ + SUBDIRS += xcomposite-glx +} + +config_drm_egl_server: \ + SUBDIRS += drm-egl-server diff --git a/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.json b/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.json new file mode 100644 index 000000000..e2266ec60 --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "drm-egl-server" ] +} diff --git a/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro b/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro new file mode 100644 index 000000000..a4e53f61a --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/drm-egl-server/drm-egl-server.pro @@ -0,0 +1,12 @@ +PLUGIN_TYPE = wayland-graphics-integration/server +load(qt_plugin) + +QT = compositor compositor-private core-private gui-private + +OTHER_FILES += drm-egl-server.json + +SOURCES += \ + main.cpp + +include($PWD/../../../../../hardwareintegration/compositor/drm-egl-server/drm-egl-server.pri) + diff --git a/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp b/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp new file mode 100644 index 000000000..713791ccc --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** 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 <QtCompositor/qwaylandserverbufferintegrationplugin.h> +#include "drmeglserverbufferintegration.h" + +QT_BEGIN_NAMESPACE + +class DrmEglServerBufferIntegrationPlugin : public QWaylandServerBufferIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.QWaylandServerBufferIntegrationFactoryInterface.5.1" FILE "drm-egl-server.json") +public: + QStringList keys() const; + QWaylandServerBufferIntegration *create(const QString&, const QStringList&); +}; + +QStringList DrmEglServerBufferIntegrationPlugin::keys() const +{ + QStringList list; + list << "drm-egl-server"; + return list; +} + +QWaylandServerBufferIntegration *DrmEglServerBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "drm-egl-server") + return new DrmEglServerBufferIntegration(); + + return 0; +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/waylandcompositors/wayland-egl/main.cpp b/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp index fcf917a10..8a2225894 100644 --- a/src/plugins/waylandcompositors/wayland-egl/main.cpp +++ b/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp @@ -39,18 +39,19 @@ ** ****************************************************************************/ -#include <QtCompositor/qwaylandgraphicshardwareintegrationplugin.h> -#include "waylandeglintegration.h" +#include <QtCompositor/qwaylandclientbufferintegrationfactory.h> +#include <QtCompositor/qwaylandclientbufferintegrationplugin.h> +#include "waylandeglclientbufferintegration.h" QT_BEGIN_NAMESPACE -class QWaylandIntegrationPlugin : public QWaylandGraphicsHardwareIntegrationPlugin +class QWaylandIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.QWaylandGraphicsHardwareIntegrationFactoryInterface.5.3" FILE "wayland-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "wayland-egl.json") public: QStringList keys() const; - QWaylandGraphicsHardwareIntegration *create(const QString&, const QStringList&); + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); }; QStringList QWaylandIntegrationPlugin::keys() const @@ -60,11 +61,11 @@ QStringList QWaylandIntegrationPlugin::keys() const return list; } -QWaylandGraphicsHardwareIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); if (system.toLower() == "wayland-egl") - return new WaylandEglIntegration(); + return new WaylandEglClientBufferIntegration(); return 0; } diff --git a/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.json b/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.json new file mode 100644 index 000000000..4ea5bab90 --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "wayland-egl" ] +} diff --git a/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro b/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro new file mode 100644 index 000000000..f0ad78ba1 --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/wayland-egl/wayland-egl.pro @@ -0,0 +1,11 @@ +PLUGIN_TYPE = wayland-graphics-integration/server +load(qt_plugin) + +QT = compositor compositor-private core-private gui-private + +OTHER_FILES += wayland-egl.json + +SOURCES += \ + main.cpp + +include(../../../../hardwareintegration/compositor/wayland-egl/wayland-egl.pri) diff --git a/src/plugins/waylandcompositors/xcomposite-egl/main.cpp b/src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp index 93f25fd80..8dd43e915 100644 --- a/src/plugins/waylandcompositors/xcomposite-egl/main.cpp +++ b/src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp @@ -39,32 +39,32 @@ ** ****************************************************************************/ -#include <QtCompositor/qwaylandgraphicshardwareintegrationplugin.h> +#include <QtCompositor/qwaylandclientbufferintegrationplugin.h> #include "xcompositeeglintegration.h" QT_BEGIN_NAMESPACE -class QWaylandIntegrationPlugin : public QWaylandGraphicsHardwareIntegrationPlugin +class QWaylandXCompositeClientBufferIntegration : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.QWaylandGraphicsHardwareIntegrationFactoryInterface.5.3" FILE "xcomposite-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "xcomposite-egl.json") public: QStringList keys() const; - QWaylandGraphicsHardwareIntegration *create(const QString&, const QStringList&); + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); }; -QStringList QWaylandIntegrationPlugin::keys() const +QStringList QWaylandXCompositeClientBufferIntegration::keys() const { QStringList list; list << "wayland-xcomposite"; return list; } -QWaylandGraphicsHardwareIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandXCompositeClientBufferIntegration::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); if (system.toLower() == "wayland-xcomposite") - return new XCompositeEglIntegration(); + return new XCompositeEglClientBufferIntegration(); return 0; } diff --git a/src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.json b/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json index 8ccd5b46b..8ccd5b46b 100644 --- a/src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.json +++ b/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro b/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro new file mode 100644 index 000000000..9c14eb840 --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pro @@ -0,0 +1,11 @@ +PLUGIN_TYPE = wayland-graphics-integration/server +load(qt_plugin) + +QT += compositor compositor-private core-private gui-private + +OTHER_FILES += xcomposite-egl.json + +SOURCES += \ + main.cpp + +include(../../../../hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.pri) diff --git a/src/plugins/waylandcompositors/xcomposite-glx/main.cpp b/src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp index 33c5440cb..b7673893e 100644 --- a/src/plugins/waylandcompositors/xcomposite-glx/main.cpp +++ b/src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp @@ -39,32 +39,32 @@ ** ****************************************************************************/ -#include <QtCompositor/qwaylandgraphicshardwareintegrationplugin.h> +#include <QtCompositor/qwaylandclientbufferintegrationplugin.h> #include "xcompositeglxintegration.h" QT_BEGIN_NAMESPACE -class QWaylandIntegrationPlugin : public QWaylandGraphicsHardwareIntegrationPlugin +class QWaylandXCompositeClientBufferIntegration : public QWaylandClientBufferIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.QWaylandGraphicsHardwareIntegrationFactoryInterface.5.3" FILE "xcomposite-glx.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Compositor.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "xcomposite-glx.json") public: QStringList keys() const; - QWaylandGraphicsHardwareIntegration *create(const QString&, const QStringList&); + QWaylandClientBufferIntegration *create(const QString&, const QStringList&); }; -QStringList QWaylandIntegrationPlugin::keys() const +QStringList QWaylandXCompositeClientBufferIntegration::keys() const { QStringList list; - list << "wayland-xcomposite"; + list << "wayland-xcomposite-glx"; return list; } -QWaylandGraphicsHardwareIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QWaylandClientBufferIntegration *QWaylandXCompositeClientBufferIntegration::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "wayland-xcomposite") - return new XCompositeGLXIntegration(); + if (system.toLower() == "wayland-xcomposite-glx") + return new XCompositeGLXClientBufferIntegration(); return 0; } diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json new file mode 100644 index 000000000..8ccd5b46b --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "wayland-xcomposite" ] +} diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro new file mode 100644 index 000000000..8ec0e5642 --- /dev/null +++ b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pro @@ -0,0 +1,11 @@ +PLUGIN_TYPE = wayland-graphics-integration/server +load(qt_plugin) + +QT += compositor compositor-private core-private gui-private + +OTHER_FILES += xcomposite-glx.json + +SOURCES += \ + main.cpp + +include(../../../../hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.pri) diff --git a/src/plugins/hardwareintegration/hardwareintegration.pro b/src/plugins/hardwareintegration/hardwareintegration.pro new file mode 100644 index 000000000..4f5ec1458 --- /dev/null +++ b/src/plugins/hardwareintegration/hardwareintegration.pro @@ -0,0 +1,7 @@ +TEMPLATE=subdirs + +SUBDIRS += client +#The compositor plugins are only useful with QtCompositor +contains(CONFIG, wayland-compositor) { + SUBDIRS += compositor +} diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 167602901..0665511c5 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -1,25 +1,22 @@ TEMPLATE=subdirs CONFIG+=ordered -SUBDIRS += wayland_common -equals(QT_WAYLAND_GL_CONFIG, nogl) { - SUBDIRS += qwayland-nogl -} else { - config_wayland_egl { - SUBDIRS += qwayland-egl - } +SUBDIRS += qwayland-generic + +config_wayland_egl { + SUBDIRS += qwayland-egl +} - #The following integrations are only useful with QtCompositor - contains(CONFIG, wayland-compositor) { - config_brcm_egl { - SUBDIRS += qwayland-brcm-egl - } - config_xcomposite { - config_egl { - SUBDIRS += qwayland-xcomposite-egl - } else:config_glx { - SUBDIRS += qwayland-xcomposite-glx - } - } +#The following integrations are only useful with QtCompositor +contains(CONFIG, wayland-compositor) { + config_brcm_egl: \ + SUBDIRS += qwayland-brcm-egl + + config_xcomposite { + config_egl: \ + SUBDIRS += qwayland-xcomposite-egl + !contains(QT_CONFIG, opengles2):config_glx: \ + SUBDIRS += qwayland-xcomposite-glx } } + diff --git a/src/plugins/platforms/qwayland-brcm-egl/main.cpp b/src/plugins/platforms/qwayland-brcm-egl/main.cpp index f395705e5..c8c4eef12 100644 --- a/src/plugins/platforms/qwayland-brcm-egl/main.cpp +++ b/src/plugins/platforms/qwayland-brcm-egl/main.cpp @@ -40,14 +40,14 @@ ****************************************************************************/ #include <qpa/qplatformintegrationplugin.h> -#include "qwaylandintegration.h" +#include "qwaylandbrcmeglplatformintegration.h" QT_BEGIN_NAMESPACE class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" FILE "qwayland-brcm-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "qwayland-brcm-egl.json") public: QStringList keys() const; QPlatformIntegration *create(const QString&, const QStringList&); @@ -64,7 +64,7 @@ QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, c { Q_UNUSED(paramList); if (system.toLower() == "wayland-brcm") - return new QWaylandIntegration(); + return new QWaylandBrcmEglPlatformIntegration(); return 0; } diff --git a/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro b/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro index 2e5a66e96..31bc718ff 100644 --- a/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro +++ b/src/plugins/platforms/qwayland-brcm-egl/qwayland-brcm-egl.pro @@ -1,20 +1,14 @@ PLUGIN_TYPE = platforms load(qt_plugin) -include(../wayland_common/wayland_common.pri) +QT += waylandclient-private + +include(../../../hardwareintegration/client/brcm-egl/brcm-egl.pri) LIBS += -lEGL OTHER_FILES += \ qwayland-brcm-egl.json -SOURCES += qwaylandbrcmeglintegration.cpp \ - qwaylandbrcmglcontext.cpp \ - qwaylandbrcmeglwindow.cpp \ - main.cpp - -HEADERS += qwaylandbrcmeglintegration.h \ - qwaylandbrcmglcontext.h \ - qwaylandbrcmeglwindow.h +SOURCES += main.cpp -WAYLANDCLIENTSOURCES += ../../../extensions/brcm.xml diff --git a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglintegration.cpp b/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglintegration.cpp deleted file mode 100644 index f82ad6f97..000000000 --- a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglintegration.cpp +++ /dev/null @@ -1,132 +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 "qwaylandbrcmeglintegration.h" - -#include "qwaylandglintegration.h" - -#include "qwaylandbrcmeglwindow.h" -#include "qwaylandbrcmglcontext.h" - -#include <QtCore/QDebug> - -#include "wayland-brcm-client-protocol.h" - -QT_BEGIN_NAMESPACE - -QWaylandBrcmEglIntegration::QWaylandBrcmEglIntegration(QWaylandDisplay *waylandDisplay) - : m_waylandDisplay(waylandDisplay->wl_display()) -{ - qDebug() << "Using Brcm-EGL"; - waylandDisplay->addRegistryListener(wlDisplayHandleGlobal, this); -} - -void QWaylandBrcmEglIntegration::wlDisplayHandleGlobal(void *data, struct wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) -{ - Q_UNUSED(version); - if (interface == "qt_brcm") { - QWaylandBrcmEglIntegration *integration = static_cast<QWaylandBrcmEglIntegration *>(data); - integration->m_waylandBrcm = static_cast<struct qt_brcm *>(wl_registry_bind(registry, id, &qt_brcm_interface, 1)); - } -} - -qt_brcm *QWaylandBrcmEglIntegration::waylandBrcm() const -{ - return m_waylandBrcm; -} - -QWaylandBrcmEglIntegration::~QWaylandBrcmEglIntegration() -{ - eglTerminate(m_eglDisplay); -} - -void QWaylandBrcmEglIntegration::initialize() -{ - EGLint major,minor; - m_eglDisplay = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); - if (m_eglDisplay == NULL) { - qWarning("EGL not available"); - } else { - if (!eglInitialize(m_eglDisplay, &major, &minor)) { - qWarning("failed to initialize EGL display"); - return; - } - - eglFlushBRCM = (PFNEGLFLUSHBRCMPROC)eglGetProcAddress("eglFlushBRCM"); - if (!eglFlushBRCM) { - qWarning("failed to resolve eglFlushBRCM, performance will suffer"); - } - - eglCreateGlobalImageBRCM = ::eglCreateGlobalImageBRCM; - if (!eglCreateGlobalImageBRCM) { - qWarning("failed to resolve eglCreateGlobalImageBRCM"); - return; - } - - eglDestroyGlobalImageBRCM = ::eglDestroyGlobalImageBRCM; - if (!eglDestroyGlobalImageBRCM) { - qWarning("failed to resolve eglDestroyGlobalImageBRCM"); - return; - } - } -} - -QWaylandWindow *QWaylandBrcmEglIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandBrcmEglWindow(window); -} - -QPlatformOpenGLContext *QWaylandBrcmEglIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandBrcmGLContext(m_eglDisplay, glFormat, share); -} - -EGLDisplay QWaylandBrcmEglIntegration::eglDisplay() const -{ - return m_eglDisplay; -} - -QWaylandGLIntegration *QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandBrcmEglIntegration(waylandDisplay); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglintegration.h b/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglintegration.h deleted file mode 100644 index f1100d8de..000000000 --- a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglintegration.h +++ /dev/null @@ -1,94 +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 QWAYLANDBRCMEGLINTEGRATION_H -#define QWAYLANDBRCMEGLINTEGRATION_H - -#include "qwaylandglintegration.h" - -#include <EGL/egl.h> -#include <EGL/eglext.h> - -#define EGL_EGLEXT_PROTOTYPES -#include <EGL/eglext_brcm.h> - -#include <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - -class QWaylandWindow; -class QWindow; - -struct qt_brcm; - -class QWaylandBrcmEglIntegration : public QWaylandGLIntegration -{ -public: - QWaylandBrcmEglIntegration(QWaylandDisplay *waylandDisplay); - ~QWaylandBrcmEglIntegration(); - - void initialize(); - - bool supportsThreadedOpenGL() const { return true; } - - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - - EGLDisplay eglDisplay() const; - - struct qt_brcm *waylandBrcm() const; - - PFNEGLFLUSHBRCMPROC eglFlushBRCM; - PFNEGLCREATEGLOBALIMAGEBRCMPROC eglCreateGlobalImageBRCM; - PFNEGLDESTROYGLOBALIMAGEBRCMPROC eglDestroyGlobalImageBRCM; - -private: - static void wlDisplayHandleGlobal(void *data, struct wl_registry *registry, uint32_t id, const QString &interface, uint32_t version); - - struct wl_display *m_waylandDisplay; - struct qt_brcm *m_waylandBrcm; - - EGLDisplay m_eglDisplay; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDBRCMEGLINTEGRATION_H diff --git a/src/plugins/platforms/wayland_common/qwaylandsubsurface.h b/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglplatformintegration.h index 10290d8c1..7dbe82fee 100644 --- a/src/plugins/platforms/wayland_common/qwaylandsubsurface.h +++ b/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglplatformintegration.h @@ -39,33 +39,31 @@ ** ****************************************************************************/ -#ifndef QWAYLANDSUBSURFACE_H -#define QWAYLANDSUBSURFACE_H +#ifndef QWAYLANDBRCMEGLPLATFORMINTEGRATION_H +#define QWAYLANDBRCMEGLPLATFORMINTEGRATION_H -#include <wayland-client.h> - -#include <QtCore/qglobal.h> - -#include <qwayland-sub-surface-extension.h> +#include <QtWaylandClient/qwaylandintegration.h> +#include "qwaylandbrcmeglintegration.h" QT_BEGIN_NAMESPACE -class QWaylandDisplay; -class QWaylandWindow; -class QWaylandSubSurface; - -class QWaylandSubSurface : public QtWayland::qt_sub_surface +class QWaylandBrcmEglPlatformIntegration : public QWaylandIntegration { public: - QWaylandSubSurface(QWaylandWindow *window, struct ::qt_sub_surface *sub_surface); - - void setParent(const QWaylandWindow *parent); - void adjustPositionOfChildren(); + QWaylandBrcmEglPlatformIntegration() + : QWaylandIntegration() + , m_gl_integration(new QWaylandBrcmEglIntegration(display()) + { + } + QWaylandGLIntegration *glIntegration() const Q_DECL_OVERRIDE + { + return m_gl_integration; + } private: - QWaylandWindow *m_window; + QWaylandGLIntegration *m_gl_integration; }; QT_END_NAMESPACE -#endif // QWAYLANDSUBSURFACE_H +#endif diff --git a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglwindow.cpp b/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglwindow.cpp deleted file mode 100644 index 31db4328b..000000000 --- a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglwindow.cpp +++ /dev/null @@ -1,293 +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 "qwaylandbrcmeglwindow.h" - -#include "qwaylandbuffer.h" -#include "qwaylandscreen.h" -#include "qwaylandbrcmglcontext.h" - -#include <QtPlatformSupport/private/qeglconvenience_p.h> - -#include <QtGui/QWindow> -#include <qpa/qwindowsysteminterface.h> - -#define EGL_EGLEXT_PROTOTYPES -#include <EGL/eglext_brcm.h> - -#include "wayland-brcm-client-protocol.h" - -QT_BEGIN_NAMESPACE - -class QWaylandBrcmBuffer : public QWaylandBuffer -{ -public: - QWaylandBrcmBuffer(QWaylandDisplay *display, - struct qt_brcm *brcm, - const QSize &size, - EGLint *data, - int count) - : m_size(size) - , m_released(true) - , m_display(display) - { - wl_array_init(&m_array); - m_data = static_cast<EGLint *>(wl_array_add(&m_array, count * sizeof(EGLint))); - - for (int i = 0; i < count; ++i) - m_data[i] = data[i]; - - mBuffer = qt_brcm_create_buffer(brcm, size.width(), size.height(), &m_array); - - static const struct wl_buffer_listener buffer_listener = { - QWaylandBrcmBuffer::buffer_release - }; - - wl_buffer_add_listener(mBuffer, &buffer_listener, this); - } - - ~QWaylandBrcmBuffer() - { - wl_array_release(&m_array); - } - - QSize size() const { return m_size; } - - void bind() - { - m_released = false; - } - - void waitForRelease() - { - if (m_released) - return; - m_mutex.lock(); - while (!m_released) - m_condition.wait(&m_mutex); - m_mutex.unlock(); - } - - static void buffer_release(void *data, wl_buffer *buffer) - { - Q_UNUSED(buffer); - m_mutex.lock(); - static_cast<QWaylandBrcmBuffer *>(data)->m_released = true; - m_condition.wakeAll(); - m_mutex.unlock(); - } - -private: - static QWaitCondition m_condition; - static QMutex m_mutex; - - QSize m_size; - bool m_released; - wl_array m_array; - EGLint *m_data; - QWaylandDisplay *m_display; -}; - -QWaitCondition QWaylandBrcmBuffer::m_condition; -QMutex QWaylandBrcmBuffer::m_mutex; - -QWaylandBrcmEglWindow::QWaylandBrcmEglWindow(QWindow *window) - : QWaylandWindow(window) - , m_eglIntegration(static_cast<QWaylandBrcmEglIntegration *>(mDisplay->eglIntegration())) - , m_eglConfig(0) - , m_format(window->format()) - , m_current(0) - , m_count(0) -{ -} - -QWaylandBrcmEglWindow::~QWaylandBrcmEglWindow() -{ - destroyEglSurfaces(); -} - -QWaylandWindow::WindowType QWaylandBrcmEglWindow::windowType() const -{ - return QWaylandWindow::Egl; -} - -void QWaylandBrcmEglWindow::setGeometry(const QRect &rect) -{ - destroyEglSurfaces(); - QWaylandWindow::setGeometry(rect); -} - -QSurfaceFormat QWaylandBrcmEglWindow::format() const -{ - return m_format; -} - -void QWaylandBrcmEglWindow::destroyEglSurfaces() -{ - for (int i = 0; i < m_count; ++i) { - if (m_eglSurfaces[i]) { - eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurfaces[i]); - m_eglSurfaces[i] = 0; - // the server does this - //m_eglIntegration->eglDestroyGlobalImageBRCM(&m_globalImages[5*i]); - delete m_buffers[i]; - } - } - - m_count = 0; - m_current = 0; -} - -QSurfaceFormat brcmFixFormat(const QSurfaceFormat &f) -{ - QSurfaceFormat format = f; - format.setRedBufferSize(8); - format.setGreenBufferSize(8); - format.setBlueBufferSize(8); - format.setAlphaBufferSize(8); - return format; -} - -void QWaylandBrcmEglWindow::createEglSurfaces() -{ - QSize size(geometry().size()); - - m_count = window()->format().swapBehavior() == QSurfaceFormat::TripleBuffer ? 3 : 2; - - m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), brcmFixFormat(window()->format()), true, EGL_PIXMAP_BIT); - - m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(), m_eglConfig); - - EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM; - - EGLint rt; - eglGetConfigAttrib(m_eglIntegration->eglDisplay(), m_eglConfig, EGL_RENDERABLE_TYPE, &rt); - - if (rt & EGL_OPENGL_ES_BIT) { - pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES_BRCM; - pixel_format |= EGL_PIXEL_FORMAT_GLES_TEXTURE_BRCM; - } - - if (rt & EGL_OPENGL_ES2_BIT) { - pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES2_BRCM; - pixel_format |= EGL_PIXEL_FORMAT_GLES2_TEXTURE_BRCM; - } - - if (rt & EGL_OPENVG_BIT) { - pixel_format |= EGL_PIXEL_FORMAT_RENDER_VG_BRCM; - pixel_format |= EGL_PIXEL_FORMAT_VG_IMAGE_BRCM; - } - - if (rt & EGL_OPENGL_BIT) { - pixel_format |= EGL_PIXEL_FORMAT_RENDER_GL_BRCM; - } - - memset(m_globalImages, 0, 5 * m_count * sizeof(EGLint)); - for (int i = 0; i < m_count; ++i) { - m_eglIntegration->eglCreateGlobalImageBRCM(size.width(), size.height(), pixel_format, - 0, size.width() * 4, &m_globalImages[5*i]); - - m_globalImages[5*i+2] = size.width(); - m_globalImages[5*i+3] = size.height(); - m_globalImages[5*i+4] = pixel_format; - - EGLint attrs[] = { - EGL_VG_COLORSPACE, EGL_VG_COLORSPACE_sRGB, - EGL_VG_ALPHA_FORMAT, pixel_format & EGL_PIXEL_FORMAT_ARGB_8888_PRE_BRCM ? EGL_VG_ALPHA_FORMAT_PRE : EGL_VG_ALPHA_FORMAT_NONPRE, - EGL_NONE - }; - - m_eglSurfaces[i] = eglCreatePixmapSurface(m_eglIntegration->eglDisplay(), m_eglConfig, (EGLNativePixmapType)&m_globalImages[5*i], attrs); - if (m_eglSurfaces[i] == EGL_NO_SURFACE) - qFatal("eglCreatePixmapSurface failed: %x, global image id: %d %d\n", eglGetError(), m_globalImages[5*i], m_globalImages[5*i+1]); - m_buffers[i] = new QWaylandBrcmBuffer(mDisplay, m_eglIntegration->waylandBrcm(), size, &m_globalImages[5*i], 5); - } -} - -void QWaylandBrcmEglWindow::swapBuffers() -{ - if (m_eglIntegration->eglFlushBRCM) { - m_eglIntegration->eglFlushBRCM(); - } else { - glFlush(); - glFinish(); - } - - m_buffers[m_current]->bind(); - - m_mutex.lock(); - m_pending << m_buffers[m_current]; - m_mutex.unlock(); - - // can't use a direct call since swapBuffers might be called from a separate thread - QMetaObject::invokeMethod(this, "flushBuffers"); - - m_current = (m_current + 1) % m_count; - - m_buffers[m_current]->waitForRelease(); -} - -void QWaylandBrcmEglWindow::flushBuffers() -{ - if (m_pending.isEmpty()) - return; - - QSize size = geometry().size(); - - m_mutex.lock(); - while (!m_pending.isEmpty()) { - QWaylandBrcmBuffer *buffer = m_pending.takeFirst(); - attach(buffer, 0, 0); - damage(QRect(QPoint(), size)); - } - m_mutex.unlock(); - - mDisplay->flushRequests(); -} - -bool QWaylandBrcmEglWindow::makeCurrent(EGLContext context) -{ - if (!m_count) - const_cast<QWaylandBrcmEglWindow *>(this)->createEglSurfaces(); - return eglMakeCurrent(m_eglIntegration->eglDisplay(), m_eglSurfaces[m_current], m_eglSurfaces[m_current], context); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglwindow.h b/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglwindow.h deleted file mode 100644 index 02abd244f..000000000 --- a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmeglwindow.h +++ /dev/null @@ -1,101 +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 QWAYLANDBRCMEGLWINDOW_H -#define QWAYLANDBRCMEGLWINDOW_H - -#include "qwaylandwindow.h" -#include "qwaylandbrcmeglintegration.h" - -#include <QMutex> - -#include <EGL/egl.h> - -QT_BEGIN_NAMESPACE - -class QWaylandGLContext; -class QWaylandBrcmBuffer; - -class QWaylandBrcmEglWindow : public QWaylandWindow -{ - Q_OBJECT -public: - QWaylandBrcmEglWindow(QWindow *window); - ~QWaylandBrcmEglWindow(); - WindowType windowType() const; - void setGeometry(const QRect &rect); - - QSurfaceFormat format() const; - - bool makeCurrent(EGLContext context); - void swapBuffers(); - -private slots: - void flushBuffers(); - -private: - void createEglSurfaces(); - void destroyEglSurfaces(); - - QWaylandBrcmEglIntegration *m_eglIntegration; - struct wl_egl_window *m_waylandEglWindow; - - const QWaylandWindow *m_parentWindow; - - EGLConfig m_eglConfig; - - EGLint m_globalImages[3*5]; - EGLSurface m_eglSurfaces[3]; - - QWaylandBrcmBuffer *m_buffers[3]; - QSurfaceFormat m_format; - - int m_current; - int m_count; - - QList<QWaylandBrcmBuffer *> m_pending; - - QMutex m_mutex; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDBRCMEGLWINDOW_H diff --git a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmglcontext.cpp b/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmglcontext.cpp deleted file mode 100644 index dfb86e54c..000000000 --- a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmglcontext.cpp +++ /dev/null @@ -1,105 +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 "qwaylandbrcmglcontext.h" - -#include "qwaylanddisplay.h" -#include "qwaylandwindow.h" -#include "qwaylandbrcmeglwindow.h" - -#include <QtPlatformSupport/private/qeglconvenience_p.h> - -#include <qpa/qplatformopenglcontext.h> -#include <QtGui/QSurfaceFormat> - -QT_BEGIN_NAMESPACE - -extern QSurfaceFormat brcmFixFormat(const QSurfaceFormat &format); - -QWaylandBrcmGLContext::QWaylandBrcmGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share) - : QPlatformOpenGLContext() - , m_eglDisplay(eglDisplay) - , m_config(q_configFromGLFormat(m_eglDisplay, brcmFixFormat(format), true)) - , m_format(q_glFormatFromConfig(m_eglDisplay, m_config)) -{ - EGLContext shareEGLContext = share ? static_cast<QWaylandBrcmGLContext *>(share)->eglContext() : EGL_NO_CONTEXT; - - eglBindAPI(EGL_OPENGL_ES_API); - - QVector<EGLint> eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - eglContextAttrs.append(format.majorVersion() == 1 ? 1 : 2); - eglContextAttrs.append(EGL_NONE); - - m_context = eglCreateContext(m_eglDisplay, m_config, shareEGLContext, eglContextAttrs.constData()); -} - -QWaylandBrcmGLContext::~QWaylandBrcmGLContext() -{ - eglDestroyContext(m_eglDisplay, m_context); -} - -bool QWaylandBrcmGLContext::makeCurrent(QPlatformSurface *surface) -{ - return static_cast<QWaylandBrcmEglWindow *>(surface)->makeCurrent(m_context); -} - -void QWaylandBrcmGLContext::doneCurrent() -{ - eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); -} - -void QWaylandBrcmGLContext::swapBuffers(QPlatformSurface *surface) -{ - static_cast<QWaylandBrcmEglWindow *>(surface)->swapBuffers(); -} - -void (*QWaylandBrcmGLContext::getProcAddress(const QByteArray &procName)) () -{ - return eglGetProcAddress(procName.constData()); -} - -EGLConfig QWaylandBrcmGLContext::eglConfig() const -{ - return m_config; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmglcontext.h b/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmglcontext.h deleted file mode 100644 index 7beef166b..000000000 --- a/src/plugins/platforms/qwayland-brcm-egl/qwaylandbrcmglcontext.h +++ /dev/null @@ -1,83 +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 QWAYLANDBRCMGLCONTEXT_H -#define QWAYLANDBRCMGLCONTEXT_H - -#include "qwaylanddisplay.h" - -#include <qpa/qplatformopenglcontext.h> - -#include <EGL/egl.h> - -QT_BEGIN_NAMESPACE - -class QWaylandWindow; -class QWaylandGLWindowSurface; - -class QWaylandBrcmGLContext : public QPlatformOpenGLContext { -public: - QWaylandBrcmGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share); - ~QWaylandBrcmGLContext(); - - void swapBuffers(QPlatformSurface *surface); - - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); - - void (*getProcAddress(const QByteArray &procName)) (); - - QSurfaceFormat format() const { return m_format; } - - EGLConfig eglConfig() const; - EGLContext eglContext() const { return m_context; } - -private: - EGLDisplay m_eglDisplay; - - EGLContext m_context; - EGLConfig m_config; - QSurfaceFormat m_format; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDBRCMGLCONTEXT_H diff --git a/src/plugins/platforms/qwayland-egl/main.cpp b/src/plugins/platforms/qwayland-egl/main.cpp index 6cf6fec28..6f790a14a 100644 --- a/src/plugins/platforms/qwayland-egl/main.cpp +++ b/src/plugins/platforms/qwayland-egl/main.cpp @@ -40,14 +40,14 @@ ****************************************************************************/ #include <qpa/qplatformintegrationplugin.h> -#include "qwaylandintegration.h" +#include "qwaylandeglplatformintegration.h" QT_BEGIN_NAMESPACE class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" FILE "qwayland-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "qwayland-egl.json") public: QStringList keys() const; QPlatformIntegration *create(const QString&, const QStringList&); @@ -56,15 +56,15 @@ public: QStringList QWaylandIntegrationPlugin::keys() const { QStringList list; - list << "wayland" << "wayland-egl"; + list << "wayland-egl"; return list; } QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "wayland" || system.toLower() == "wayland-egl") - return new QWaylandIntegration(); + if (system.toLower() == "wayland-egl") + return new QWaylandEglPlatformIntegration(); return 0; } diff --git a/src/plugins/platforms/qwayland-egl/qwayland-egl.json b/src/plugins/platforms/qwayland-egl/qwayland-egl.json index 3ab70d3c3..4ea5bab90 100644 --- a/src/plugins/platforms/qwayland-egl/qwayland-egl.json +++ b/src/plugins/platforms/qwayland-egl/qwayland-egl.json @@ -1,3 +1,3 @@ { - "Keys": [ "wayland", "wayland-egl" ] + "Keys": [ "wayland-egl" ] } diff --git a/src/plugins/platforms/qwayland-egl/qwayland-egl.pro b/src/plugins/platforms/qwayland-egl/qwayland-egl.pro index 339f94616..279a7c382 100644 --- a/src/plugins/platforms/qwayland-egl/qwayland-egl.pro +++ b/src/plugins/platforms/qwayland-egl/qwayland-egl.pro @@ -1,24 +1,12 @@ PLUGIN_TYPE = platforms load(qt_plugin) -include(../wayland_common/wayland_common.pri) +QT += waylandclient-private + +include(../../../hardwareintegration/client/wayland-egl/wayland-egl.pri) OTHER_FILES += \ qwayland-egl.json -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-egl egl -} else { - LIBS += -lwayland-egl -lEGL -} - -SOURCES += qwaylandeglintegration.cpp \ - qwaylandglcontext.cpp \ - qwaylandeglwindow.cpp \ - main.cpp +SOURCES += main.cpp -HEADERS += qwaylandeglintegration.h \ - qwaylandglcontext.h \ - qwaylandeglwindow.h \ - qwaylandeglinclude.h diff --git a/src/plugins/platforms/qwayland-egl/qwaylandeglinclude.h b/src/plugins/platforms/qwayland-egl/qwaylandeglinclude.h deleted file mode 100644 index fb42d43c1..000000000 --- a/src/plugins/platforms/qwayland-egl/qwaylandeglinclude.h +++ /dev/null @@ -1,58 +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 QWAYLANDEGLINCLUDE_H -#define QWAYLANDEGLINCLUDE_H - -#include <string.h> -#include <wayland-client.h> - -#include <wayland-egl.h> - -#define GL_GLEXT_PROTOTYPES -#include <GLES2/gl2.h> -#include <GLES2/gl2ext.h> - -#define EGL_EGLEXT_PROTOTYPES -#include <EGL/egl.h> -#include <EGL/eglext.h> - -#endif // QWAYLANDEGLINCLUDE_H diff --git a/src/plugins/platforms/qwayland-egl/qwaylandeglintegration.cpp b/src/plugins/platforms/qwayland-egl/qwaylandeglintegration.cpp deleted file mode 100644 index 07f6d586e..000000000 --- a/src/plugins/platforms/qwayland-egl/qwaylandeglintegration.cpp +++ /dev/null @@ -1,111 +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 "qwaylandeglintegration.h" - -#include "qwaylandglintegration.h" - -#include "qwaylandeglwindow.h" -#include "qwaylandglcontext.h" - -#include <wayland-client.h> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -QWaylandEglIntegration::QWaylandEglIntegration(struct wl_display *waylandDisplay) - : m_waylandDisplay(waylandDisplay) -{ - qDebug() << "Using Wayland-EGL"; -} - - -QWaylandEglIntegration::~QWaylandEglIntegration() -{ - eglTerminate(m_eglDisplay); -} - -void QWaylandEglIntegration::initialize() -{ - QByteArray eglPlatform = qgetenv("EGL_PLATFORM"); - if (eglPlatform.isEmpty()) { - setenv("EGL_PLATFORM","wayland",true); - } - - EGLint major,minor; - m_eglDisplay = eglGetDisplay((EGLNativeDisplayType) m_waylandDisplay); - if (m_eglDisplay == NULL) { - qWarning("EGL not available"); - } else { - if (!eglInitialize(m_eglDisplay, &major, &minor)) { - qWarning("failed to initialize EGL display"); - return; - } - } -} - -bool QWaylandEglIntegration::supportsThreadedOpenGL() const -{ - return true; -} - -QWaylandWindow *QWaylandEglIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandEglWindow(window); -} - -QPlatformOpenGLContext *QWaylandEglIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandGLContext(m_eglDisplay, glFormat, share); -} - -EGLDisplay QWaylandEglIntegration::eglDisplay() const -{ - return m_eglDisplay; -} - -QWaylandGLIntegration *QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandEglIntegration(waylandDisplay->wl_display()); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-egl/qwaylandeglintegration.h b/src/plugins/platforms/qwayland-egl/qwaylandeglintegration.h deleted file mode 100644 index 64e7d97de..000000000 --- a/src/plugins/platforms/qwayland-egl/qwaylandeglintegration.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 QWAYLANDEGLINTEGRATION_H -#define QWAYLANDEGLINTEGRATION_H - -#include "qwaylandglintegration.h" - -#include "qwaylandeglinclude.h" - -QT_BEGIN_NAMESPACE - -class QWaylandWindow; -class QWindow; - -class QWaylandEglIntegration : public QWaylandGLIntegration -{ -public: - QWaylandEglIntegration(struct wl_display *waylandDisplay); - ~QWaylandEglIntegration(); - - void initialize(); - bool supportsThreadedOpenGL() const; - - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - - EGLDisplay eglDisplay() const; - -private: - struct wl_display *m_waylandDisplay; - - EGLDisplay m_eglDisplay; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDEGLINTEGRATION_H diff --git a/src/plugins/platforms/wayland_common/qwaylanddnd.h b/src/plugins/platforms/qwayland-egl/qwaylandeglplatformintegration.h index fa8f5b639..5f23f68de 100644 --- a/src/plugins/platforms/wayland_common/qwaylanddnd.h +++ b/src/plugins/platforms/qwayland-egl/qwaylandeglplatformintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 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. @@ -39,36 +39,32 @@ ** ****************************************************************************/ -#ifndef QWAYLANDDND_H -#define QWAYLANDDND_H +#ifndef QWAYLANDEGLPLATFORMINTEGRATION_H +#define QWAYLANDEGLPLATFORMINTEGRATION_H -#include <qpa/qplatformdrag.h> -#include <QtGui/QDrag> -#include <QtCore/QMimeData> -#include "qwaylanddisplay.h" +#include <QtWaylandClient/private/qwaylandintegration_p.h> + +#include "qwaylandeglclientbufferintegration.h" QT_BEGIN_NAMESPACE -class QWaylandDrag : public QPlatformDrag +class QWaylandEglPlatformIntegration : public QWaylandIntegration { public: - QWaylandDrag(QWaylandDisplay *display); - ~QWaylandDrag(); - - QMimeData *platformDropData(); - - Qt::DropAction drag(QDrag *m_drag); - void move(const QMouseEvent *me); - bool canDrop() const; - void drop(const QMouseEvent *me); - void cancel(); + QWaylandEglPlatformIntegration() + : QWaylandIntegration() + , m_client_buffer_integration(new QWaylandEglClientBufferIntegration()) + { + m_client_buffer_integration->initialize(display()); + } - virtual Qt::DropAction executedDropAction() const; + QWaylandEglClientBufferIntegration *clientBufferIntegration() const + { return m_client_buffer_integration; } private: - QWaylandDisplay *m_display; + QWaylandEglClientBufferIntegration *m_client_buffer_integration; }; QT_END_NAMESPACE -#endif // QWAYLANDDND_H +#endif diff --git a/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.cpp b/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.cpp deleted file mode 100644 index 7829f381a..000000000 --- a/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.cpp +++ /dev/null @@ -1,171 +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 "qwaylandeglwindow.h" - -#include "qwaylandscreen.h" -#include "qwaylandglcontext.h" - -#include <QtPlatformSupport/private/qeglconvenience_p.h> - -#include <QDebug> -#include <QtGui/QWindow> -#include <qpa/qwindowsysteminterface.h> -#include <QOpenGLFramebufferObject> -#include <QOpenGLContext> - -QT_BEGIN_NAMESPACE - -QWaylandEglWindow::QWaylandEglWindow(QWindow *window) - : QWaylandWindow(window) - , m_eglIntegration(static_cast<QWaylandEglIntegration *>(mDisplay->eglIntegration())) - , m_waylandEglWindow(0) - , m_eglSurface(0) - , m_eglConfig(0) - , m_contentFBO(0) - , m_resize(false) - , m_format(window->requestedFormat()) -{ - setGeometry(window->geometry()); -} - -QWaylandEglWindow::~QWaylandEglWindow() -{ - if (m_eglSurface) { - eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurface); - m_eglSurface = 0; - } - - wl_egl_window_destroy(m_waylandEglWindow); - - delete m_contentFBO; -} - -QWaylandWindow::WindowType QWaylandEglWindow::windowType() const -{ - return QWaylandWindow::Egl; -} - -void QWaylandEglWindow::setGeometry(const QRect &rect) -{ - createDecoration(); - QMargins margins = frameMargins(); - QSize sizeWithMargins = rect.size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom()); - - if (m_waylandEglWindow) { - int current_width, current_height; - wl_egl_window_get_attached_size(m_waylandEglWindow,¤t_width,¤t_height); - if (current_width != sizeWithMargins.width() || current_height != sizeWithMargins.height()) { - wl_egl_window_resize(m_waylandEglWindow, sizeWithMargins.width(), sizeWithMargins.height(), mOffset.x(), mOffset.y()); - mOffset = QPoint(); - - m_resize = true; - } - } else { - m_waylandEglWindow = wl_egl_window_create(object(), sizeWithMargins.width(), sizeWithMargins.height()); - } - - QWaylandWindow::setGeometry(rect); -} - -QRect QWaylandEglWindow::contentsRect() const -{ - QRect r = geometry(); - QMargins m = frameMargins(); - return QRect(m.left(), m.bottom(), r.width(), r.height()); -} - -QSurfaceFormat QWaylandEglWindow::format() const -{ - return m_format; -} - -EGLSurface QWaylandEglWindow::eglSurface() const -{ - if (!m_waylandEglWindow) { - QWaylandEglWindow *self = const_cast<QWaylandEglWindow *>(this); - self->createDecoration(); - QMargins margins = frameMargins(); - QSize sizeWithMargins = geometry().size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom()); - m_waylandEglWindow = wl_egl_window_create(self->object(), sizeWithMargins.width(), sizeWithMargins.height()); - } - - if (!m_eglSurface) { - m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), window()->format(), true); - const_cast<QWaylandEglWindow *>(this)->m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(),m_eglConfig); - - EGLNativeWindowType window = (EGLNativeWindowType) m_waylandEglWindow; - m_eglSurface = eglCreateWindowSurface(m_eglIntegration->eglDisplay(), m_eglConfig, window, 0); - } - - return m_eglSurface; -} - -GLuint QWaylandEglWindow::contentFBO() const -{ - if (!decoration()) - return 0; - - if (m_resize || !m_contentFBO) { - QOpenGLFramebufferObject *old = m_contentFBO; - m_contentFBO = new QOpenGLFramebufferObject(geometry().width(), geometry().height(), QOpenGLFramebufferObject::CombinedDepthStencil); - - delete old; - m_resize = false; - } - - return m_contentFBO->handle(); -} - -GLuint QWaylandEglWindow::contentTexture() const -{ - return m_contentFBO->texture(); -} - -void QWaylandEglWindow::bindContentFBO() -{ - if (decoration()) { - contentFBO(); - m_contentFBO->bind(); - } -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.h b/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.h deleted file mode 100644 index f973547a7..000000000 --- a/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.h +++ /dev/null @@ -1,88 +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 QWAYLANDEGLWINDOW_H -#define QWAYLANDEGLWINDOW_H - -#include "qwaylandwindow.h" -#include "qwaylandeglinclude.h" -#include "qwaylandeglintegration.h" - -QT_BEGIN_NAMESPACE - -class QWaylandGLContext; -class QOpenGLFramebufferObject; - -class QWaylandEglWindow : public QWaylandWindow -{ -public: - QWaylandEglWindow(QWindow *window); - ~QWaylandEglWindow(); - WindowType windowType() const; - - virtual void setGeometry(const QRect &rect); - QRect contentsRect() const; - - EGLSurface eglSurface() const; - GLuint contentFBO() const; - GLuint contentTexture() const; - - QSurfaceFormat format() const; - - void bindContentFBO(); - -private: - QWaylandEglIntegration *m_eglIntegration; - mutable struct wl_egl_window *m_waylandEglWindow; - - const QWaylandWindow *m_parentWindow; - - mutable EGLSurface m_eglSurface; - mutable EGLConfig m_eglConfig; - mutable QOpenGLFramebufferObject *m_contentFBO; - mutable bool m_resize; - - QSurfaceFormat m_format; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDEGLWINDOW_H diff --git a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp deleted file mode 100644 index 303e59f76..000000000 --- a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp +++ /dev/null @@ -1,236 +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 "qwaylandglcontext.h" - -#include "qwaylanddisplay.h" -#include "qwaylandwindow.h" -#include "qwaylandeglwindow.h" -#include "qwaylanddecoration.h" - -#include <QDebug> -#include <QtPlatformSupport/private/qeglconvenience_p.h> -#include <QtGui/private/qopenglcontext_p.h> -#include <QtGui/private/qopengltexturecache_p.h> - -#include <qpa/qplatformopenglcontext.h> -#include <QtGui/QSurfaceFormat> -#include <QtGui/QOpenGLShaderProgram> - -QT_BEGIN_NAMESPACE - -QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share) - : QPlatformOpenGLContext() - , m_eglDisplay(eglDisplay) - , m_config(q_configFromGLFormat(m_eglDisplay, format, true)) - , m_format(q_glFormatFromConfig(m_eglDisplay, m_config)) - , m_blitProgram(0) - , m_textureCache(0) -{ - m_shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT; - - eglBindAPI(EGL_OPENGL_ES_API); - - QVector<EGLint> eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - eglContextAttrs.append(format.majorVersion() == 1 ? 1 : 2); - eglContextAttrs.append(EGL_NONE); - - m_context = eglCreateContext(m_eglDisplay, m_config, m_shareEGLContext, eglContextAttrs.constData()); - - if (m_context == EGL_NO_CONTEXT) { - m_context = eglCreateContext(m_eglDisplay, m_config, EGL_NO_CONTEXT, eglContextAttrs.constData()); - m_shareEGLContext = EGL_NO_CONTEXT; - } -} - -QWaylandGLContext::~QWaylandGLContext() -{ - delete m_blitProgram; - delete m_textureCache; - eglDestroyContext(m_eglDisplay, m_context); -} - -bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface) -{ - QWaylandEglWindow *window = static_cast<QWaylandEglWindow *>(surface); - - window->setCanResize(false); - - EGLSurface eglSurface = window->eglSurface(); - if (!eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) { - qWarning("QEGLPlatformContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this); - return false; - } - - window->bindContentFBO(); - - return true; -} - -void QWaylandGLContext::doneCurrent() -{ - eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); -} - -void QWaylandGLContext::swapBuffers(QPlatformSurface *surface) -{ - QWaylandEglWindow *window = static_cast<QWaylandEglWindow *>(surface); - - EGLSurface eglSurface = window->eglSurface(); - - if (window->decoration()) { - makeCurrent(surface); - if (!m_blitProgram) { - m_blitProgram = new QOpenGLShaderProgram(); - m_blitProgram->addShaderFromSourceCode(QOpenGLShader::Vertex, "attribute vec4 position;\n\ - attribute vec4 texCoords;\n\ - varying vec2 outTexCoords;\n\ - void main()\n\ - {\n\ - gl_Position = position;\n\ - outTexCoords = texCoords.xy;\n\ - }"); - m_blitProgram->addShaderFromSourceCode(QOpenGLShader::Fragment, "varying highp vec2 outTexCoords;\n\ - uniform sampler2D texture;\n\ - void main()\n\ - {\n\ - gl_FragColor = texture2D(texture, outTexCoords);\n\ - }"); - - if (!m_blitProgram->link()) { - qDebug() << "Shader Program link failed."; - qDebug() << m_blitProgram->log(); - } - } - - if (!m_textureCache) { - m_textureCache = new QOpenGLTextureCache(this->context()); - } - - glDisable(GL_DEPTH_TEST); - glDisable(GL_BLEND); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - - static const GLfloat squareVertices[] = { - -1.f, -1.f, - 1.0f, -1.f, - -1.f, 1.0f, - 1.0f, 1.0f - }; - - static const GLfloat inverseSquareVertices[] = { - -1.f, 1.f, - 1.f, 1.f, - -1.f, -1.f, - 1.f, -1.f - }; - - static const GLfloat textureVertices[] = { - 0.0f, 0.0f, - 1.0f, 0.0f, - 0.0f, 1.0f, - 1.0f, 1.0f, - }; - - m_blitProgram->setUniformValue("texture", 0); - - m_blitProgram->enableAttributeArray("position"); - m_blitProgram->enableAttributeArray("texCoords"); - m_blitProgram->setAttributeArray("texCoords", textureVertices, 2); - - m_blitProgram->bind(); - glActiveTexture(GL_TEXTURE0); - - //Draw Decoration - m_blitProgram->setAttributeArray("position", inverseSquareVertices, 2); - QImage decorationImage = window->decoration()->contentImage(); - m_textureCache->bindTexture(context(), decorationImage); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - QRect windowRect = window->window()->frameGeometry(); - glViewport(0, 0, windowRect.width(), windowRect.height()); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - //Draw Content - m_blitProgram->setAttributeArray("position", squareVertices, 2); - glBindTexture(GL_TEXTURE_2D, window->contentTexture()); - QRect r = window->contentsRect(); - glViewport(r.x(), r.y(), r.width(), r.height()); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - //Cleanup - m_blitProgram->disableAttributeArray("position"); - m_blitProgram->disableAttributeArray("texCoords"); - m_blitProgram->release(); - } - - eglSwapBuffers(m_eglDisplay, eglSurface); - - window->setCanResize(true); -} - -GLuint QWaylandGLContext::defaultFramebufferObject(QPlatformSurface *surface) const -{ - return static_cast<QWaylandEglWindow *>(surface)->contentFBO(); -} - -bool QWaylandGLContext::isSharing() const -{ - return m_shareEGLContext != EGL_NO_CONTEXT; -} - -bool QWaylandGLContext::isValid() const -{ - return m_context != EGL_NO_CONTEXT; -} - -void (*QWaylandGLContext::getProcAddress(const QByteArray &procName)) () -{ - return eglGetProcAddress(procName.constData()); -} - -EGLConfig QWaylandGLContext::eglConfig() const -{ - return m_config; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h deleted file mode 100644 index bc231e82d..000000000 --- a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h +++ /dev/null @@ -1,93 +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 QWAYLANDGLCONTEXT_H -#define QWAYLANDGLCONTEXT_H - -#include "qwaylanddisplay.h" - -#include <qpa/qplatformopenglcontext.h> - -#include "qwaylandeglinclude.h" - -QT_BEGIN_NAMESPACE - -class QWaylandWindow; -class QWaylandGLWindowSurface; -class QOpenGLShaderProgram; -class QOpenGLTextureCache; - -class QWaylandGLContext : public QPlatformOpenGLContext { -public: - QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share); - ~QWaylandGLContext(); - - void swapBuffers(QPlatformSurface *surface); - - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); - - GLuint defaultFramebufferObject(QPlatformSurface *surface) const; - - bool isSharing() const; - bool isValid() const; - - void (*getProcAddress(const QByteArray &procName)) (); - - QSurfaceFormat format() const { return m_format; } - - EGLConfig eglConfig() const; - EGLContext eglContext() const { return m_context; } - -private: - EGLDisplay m_eglDisplay; - - EGLContext m_context; - EGLContext m_shareEGLContext; - EGLConfig m_config; - QSurfaceFormat m_format; - QOpenGLShaderProgram *m_blitProgram; - QOpenGLTextureCache *m_textureCache; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDGLCONTEXT_H diff --git a/src/plugins/platforms/qwayland-nogl/main.cpp b/src/plugins/platforms/qwayland-generic/main.cpp index e1ae9de86..0575d0dc2 100644 --- a/src/plugins/platforms/qwayland-nogl/main.cpp +++ b/src/plugins/platforms/qwayland-generic/main.cpp @@ -40,14 +40,14 @@ ****************************************************************************/ #include <qpa/qplatformintegrationplugin.h> -#include "qwaylandintegration.h" +#include <QtWaylandClient/private/qwaylandintegration_p.h> QT_BEGIN_NAMESPACE class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" FILE "qwayland-nogl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "qwayland-generic.json") public: QStringList keys() const; QPlatformIntegration *create(const QString&, const QStringList&); @@ -56,14 +56,14 @@ public: QStringList QWaylandIntegrationPlugin::keys() const { QStringList list; - list << "wayland" << "wayland-nogl"; + list << "wayland"; return list; } QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "wayland" || system.toLower() == "wayland-nogl") + if (system.toLower() == "wayland") return new QWaylandIntegration(); return 0; diff --git a/src/plugins/platforms/qwayland-generic/qwayland-generic.json b/src/plugins/platforms/qwayland-generic/qwayland-generic.json new file mode 100644 index 000000000..8e56c4fd8 --- /dev/null +++ b/src/plugins/platforms/qwayland-generic/qwayland-generic.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "wayland" ] +} diff --git a/src/plugins/platforms/qwayland-generic/qwayland-generic.pro b/src/plugins/platforms/qwayland-generic/qwayland-generic.pro new file mode 100644 index 000000000..cf42d1eb8 --- /dev/null +++ b/src/plugins/platforms/qwayland-generic/qwayland-generic.pro @@ -0,0 +1,10 @@ +PLUGIN_TYPE = platforms +load(qt_plugin) + +QT += waylandclient-private + +OTHER_FILES += \ + qwayland-generic.json + +SOURCES += main.cpp + diff --git a/src/plugins/platforms/qwayland-nogl/qwayland-nogl.json b/src/plugins/platforms/qwayland-nogl/qwayland-nogl.json deleted file mode 100644 index 8cbc863f9..000000000 --- a/src/plugins/platforms/qwayland-nogl/qwayland-nogl.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Keys": [ "wayland", "wayland-nogl" ] -} diff --git a/src/plugins/platforms/qwayland-nogl/qwayland-nogl.pro b/src/plugins/platforms/qwayland-nogl/qwayland-nogl.pro deleted file mode 100644 index cb3b86eb5..000000000 --- a/src/plugins/platforms/qwayland-nogl/qwayland-nogl.pro +++ /dev/null @@ -1,8 +0,0 @@ -PLUGIN_TYPE = platforms -load(qt_plugin) - -include(../wayland_common/wayland_common.pri) - -OTHER_FILES += qwayland-nogl.json - -SOURCES += main.cpp diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp b/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp index 4b37cab60..b065a4659 100644 --- a/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp +++ b/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp @@ -40,14 +40,14 @@ ****************************************************************************/ #include <qpa/qplatformintegrationplugin.h> -#include "qwaylandintegration.h" +#include "qwaylandxcompositeeglplatformintegration.h" QT_BEGIN_NAMESPACE class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" FILE "qwayland-xcomposite-egl.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "qwayland-xcomposite-egl.json") public: QStringList keys() const; QPlatformIntegration *create(const QString&, const QStringList&); @@ -56,15 +56,15 @@ public: QStringList QWaylandIntegrationPlugin::keys() const { QStringList list; - list << "wayland-xcomposite"; + list << "wayland-xcomposite" << "wayland-xcomposite-egl"; return list; } QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "wayland-xcomposite") - return new QWaylandIntegration(); + if (system.toLower() == "wayland-xcomposite" || system.toLower() == "wayland-xcomposite-egl") + return new QWaylandXCompositeEglPlatformIntegration(); return 0; } diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.pro b/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.pro index b691ec9dc..74a71a57a 100644 --- a/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.pro +++ b/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.pro @@ -1,25 +1,12 @@ PLUGIN_TYPE = platforms load(qt_plugin) -include(../wayland_common/wayland_common.pri) -include (../xcomposite_share/xcomposite_share.pri) +QT += waylandclient-private -OTHER_FILES += qwayland-xcomposite-egl.json +include(../../../hardwareintegration/client/xcomposite-egl/xcomposite-egl.pri) -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += xcomposite egl x11 -} else { - LIBS += -lXcomposite -lEGL -lX11 -} +OTHER_FILES += qwayland-xcomposite-egl.json SOURCES += \ - qwaylandxcompositeeglcontext.cpp \ - qwaylandxcompositeeglintegration.cpp \ - qwaylandxcompositeeglwindow.cpp \ main.cpp -HEADERS += \ - qwaylandxcompositeeglcontext.h \ - qwaylandxcompositeeglintegration.h \ - qwaylandxcompositeeglwindow.h diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglcontext.cpp b/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglcontext.cpp deleted file mode 100644 index 1ebcdde13..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglcontext.cpp +++ /dev/null @@ -1,78 +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 "qwaylandxcompositeeglcontext.h" - -#include "qwaylandxcompositeeglwindow.h" - -#include <QtCore/QDebug> -#include <QtGui/QRegion> - -#include <QtPlatformSupport/private/qeglconvenience_p.h> - -QT_BEGIN_NAMESPACE - -QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display) - : QEGLPlatformContext(format, share, display, q_configFromGLFormat(display, format, true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT), EGL_OPENGL_ES_API) -{ -} - -void QWaylandXCompositeEGLContext::swapBuffers(QPlatformSurface *surface) -{ - QEGLPlatformContext::swapBuffers(surface); - - QWaylandXCompositeEGLWindow *w = - static_cast<QWaylandXCompositeEGLWindow *>(surface); - - QSize size = w->geometry().size(); - - w->attach(w->buffer(), 0, 0); - w->damage(QRect(QPoint(), size)); - w->commit(); - w->waitForFrameSync(); -} - -EGLSurface QWaylandXCompositeEGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) -{ - return static_cast<QWaylandXCompositeEGLWindow *>(surface)->eglSurface(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglintegration.cpp b/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglintegration.cpp deleted file mode 100644 index cd3a06ff8..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglintegration.cpp +++ /dev/null @@ -1,146 +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 "qwaylandxcompositeeglintegration.h" - -#include "qwaylandxcompositeeglwindow.h" - -#include <QtCore/QDebug> - -#include "wayland-xcomposite-client-protocol.h" - -QT_BEGIN_NAMESPACE - -QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandXCompositeEGLIntegration(waylandDisplay); -} - -QWaylandXCompositeEGLIntegration::QWaylandXCompositeEGLIntegration(QWaylandDisplay * waylandDisplay) - : QWaylandGLIntegration() - , mWaylandDisplay(waylandDisplay) -{ - qDebug() << "Using XComposite-EGL"; - waylandDisplay->addRegistryListener(&wlDisplayHandleGlobal, this); -} - -QWaylandXCompositeEGLIntegration::~QWaylandXCompositeEGLIntegration() -{ - XCloseDisplay(mDisplay); -} - -void QWaylandXCompositeEGLIntegration::initialize() -{ -} - -QWaylandWindow * QWaylandXCompositeEGLIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandXCompositeEGLWindow(window,this); -} - -QPlatformOpenGLContext *QWaylandXCompositeEGLIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandXCompositeEGLContext(glFormat, share, eglDisplay()); -} - -Display * QWaylandXCompositeEGLIntegration::xDisplay() const -{ - return mDisplay; -} - -EGLDisplay QWaylandXCompositeEGLIntegration::eglDisplay() const -{ - return mEglDisplay; -} - -int QWaylandXCompositeEGLIntegration::screen() const -{ - return mScreen; -} - -Window QWaylandXCompositeEGLIntegration::rootWindow() const -{ - return mRootWindow; -} - -QWaylandDisplay * QWaylandXCompositeEGLIntegration::waylandDisplay() const -{ - return mWaylandDisplay; -} -qt_xcomposite * QWaylandXCompositeEGLIntegration::waylandXComposite() const -{ - return mWaylandComposite; -} - -const struct qt_xcomposite_listener QWaylandXCompositeEGLIntegration::xcomposite_listener = { - QWaylandXCompositeEGLIntegration::rootInformation -}; - -void QWaylandXCompositeEGLIntegration::wlDisplayHandleGlobal(void *data, wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) -{ - Q_UNUSED(version); - if (interface == "qt_xcomposite") { - QWaylandXCompositeEGLIntegration *integration = static_cast<QWaylandXCompositeEGLIntegration *>(data); - integration->mWaylandComposite = static_cast<struct qt_xcomposite *>(wl_registry_bind(registry,id,&qt_xcomposite_interface,1)); - qt_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration); - } - -} - -void QWaylandXCompositeEGLIntegration::rootInformation(void *data, qt_xcomposite *xcomposite, const char *display_name, uint32_t root_window) -{ - Q_UNUSED(xcomposite); - QWaylandXCompositeEGLIntegration *integration = static_cast<QWaylandXCompositeEGLIntegration *>(data); - - integration->mDisplay = XOpenDisplay(display_name); - integration->mRootWindow = (Window) root_window; - integration->mScreen = XDefaultScreen(integration->mDisplay); - integration->mEglDisplay = eglGetDisplay(integration->mDisplay); - eglBindAPI(EGL_OPENGL_ES_API); - EGLint minor,major; - if (!eglInitialize(integration->mEglDisplay,&major,&minor)) { - qFatal("Failed to initialize EGL"); - } - eglSwapInterval(integration->eglDisplay(),0); - qDebug() << "ROOT INFORMATION" << integration->mDisplay << integration->mRootWindow << integration->mScreen; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglintegration.h b/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglintegration.h deleted file mode 100644 index ba36fac3f..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglintegration.h +++ /dev/null @@ -1,114 +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 QWAYLANDXCOMPOSITEEGLINTEGRATION_H -#define QWAYLANDXCOMPOSITEEGLINTEGRATION_H - -#include "qwaylandglintegration.h" -#include "wayland-client.h" - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> -#include <QtGui/QWindow> - -#include <qpa/qplatformopenglcontext.h> - -#include <QWaitCondition> - -#include <X11/Xlib.h> -#include <EGL/egl.h> - -// avoid clashes with Qt::CursorShape -#ifdef CursorShape -# define X_CursorShape CursorShape -# undef CursorShape -#endif - -struct qt_xcomposite; - -QT_BEGIN_NAMESPACE - -class QWaylandXCompositeEGLIntegration : public QWaylandGLIntegration -{ -public: - QWaylandXCompositeEGLIntegration(QWaylandDisplay * waylandDispaly); - ~QWaylandXCompositeEGLIntegration(); - - void initialize(); - bool waitingForEvents() { return !mDisplay; } - - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - - QWaylandDisplay *waylandDisplay() const; - struct qt_xcomposite *waylandXComposite() const; - - Display *xDisplay() const; - EGLDisplay eglDisplay() const; - int screen() const; - Window rootWindow() const; - - bool supportsThreadedOpenGL() const { return true; } - -private: - QWaylandDisplay *mWaylandDisplay; - struct qt_xcomposite *mWaylandComposite; - - Display *mDisplay; - EGLDisplay mEglDisplay; - int mScreen; - Window mRootWindow; - - static void wlDisplayHandleGlobal(void *data, struct wl_registry *registry, uint32_t id, - const QString &interface, uint32_t version); - - static const struct qt_xcomposite_listener xcomposite_listener; - static void rootInformation(void *data, - struct qt_xcomposite *xcomposite, - const char *display_name, - uint32_t root_window); -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDXCOMPOSITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglcontext.h b/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglplatformintegration.h index 32cdb4322..340ab03c3 100644 --- a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglcontext.h +++ b/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglplatformintegration.h @@ -39,30 +39,32 @@ ** ****************************************************************************/ -#ifndef QWAYLANDXCOMPOSITEEGLCONTEXT_H -#define QWAYLANDXCOMPOSITEEGLCONTEXT_H +#ifndef QWAYLANDXCOMPOSITEEGLPLATFROMINTEGRATION_H +#define QWAYLANDXCOMPOSITEEGLPLATFROMINTEGRATION_H -#include <qpa/qplatformopenglcontext.h> +#include <QtWaylandClient/private/qwaylandintegration_p.h> -#include "qwaylandxcompositeeglintegration.h" - -#include <QtPlatformSupport/private/qeglplatformcontext_p.h> +#include "qwaylandxcompositeeglclientbufferintegration.h" QT_BEGIN_NAMESPACE -class QWaylandXCompositeEGLWindow; - -class QWaylandXCompositeEGLContext : public QEGLPlatformContext +class QWaylandXCompositeEglPlatformIntegration : public QWaylandIntegration { public: - QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display); + QWaylandXCompositeEglPlatformIntegration() + : QWaylandIntegration() + , m_client_buffer_integration(new QWaylandXCompositeEGLClientBufferIntegration()) + { + m_client_buffer_integration->initialize(display()); + } - void swapBuffers(QPlatformSurface *surface); + QWaylandClientBufferIntegration *clientBufferIntegration() const Q_DECL_OVERRIDE + { return m_client_buffer_integration; } private: - EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface); + QWaylandClientBufferIntegration *m_client_buffer_integration; }; QT_END_NAMESPACE -#endif // QWAYLANDXCOMPOSITEEGLCONTEXT_H +#endif diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglwindow.cpp b/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglwindow.cpp deleted file mode 100644 index 4b4144510..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglwindow.cpp +++ /dev/null @@ -1,136 +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 "qwaylandxcompositeeglwindow.h" -#include "qwaylandxcompositebuffer.h" - -#include <QtPlatformSupport/private/qeglconvenience_p.h> -#include <QtPlatformSupport/private/qxlibeglintegration_p.h> - -#include "wayland-xcomposite-client-protocol.h" - -#include <X11/extensions/Xcomposite.h> -#include "qwaylandxcompositeeglintegration.h" - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLIntegration *glxIntegration) - : QWaylandWindow(window) - , m_glxIntegration(glxIntegration) - , m_context(0) - , m_buffer(0) - , m_xWindow(0) - , m_config(q_configFromGLFormat(glxIntegration->eglDisplay(), window->format(), true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT)) - , m_surface(0) -{ -} - -QWaylandWindow::WindowType QWaylandXCompositeEGLWindow::windowType() const -{ - //yeah. this type needs a new name - return QWaylandWindow::Egl; -} - -void QWaylandXCompositeEGLWindow::setGeometry(const QRect &rect) -{ - QWaylandWindow::setGeometry(rect); - - if (m_surface) { - eglDestroySurface(m_glxIntegration->eglDisplay(), m_surface); - m_surface = 0; - } -} - -EGLSurface QWaylandXCompositeEGLWindow::eglSurface() const -{ - if (!m_surface) - const_cast<QWaylandXCompositeEGLWindow *>(this)->createEglSurface(); - return m_surface; -} - -void QWaylandXCompositeEGLWindow::createEglSurface() -{ - QSize size(geometry().size()); - if (size.isEmpty()) { - // QGLWidget wants a context for a window without geometry - size = QSize(1,1); - } - - delete m_buffer; - //XFreePixmap deletes the glxPixmap as well - if (m_xWindow) { - XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow); - } - - VisualID visualId = QXlibEglIntegration::getCompatibleVisualId(m_glxIntegration->xDisplay(), m_glxIntegration->eglDisplay(), m_config); - - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = visualId; - - int matchingCount = 0; - XVisualInfo *visualInfo = XGetVisualInfo(m_glxIntegration->xDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount); - - Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(),m_glxIntegration->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.colormap = cmap; - m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(), - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - - XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual); - XMapWindow(m_glxIntegration->xDisplay(), m_xWindow); - - m_surface = eglCreateWindowSurface(m_glxIntegration->eglDisplay(), m_config, m_xWindow,0); - if (m_surface == EGL_NO_SURFACE) { - qFatal("Could not make eglsurface"); - } - - XSync(m_glxIntegration->xDisplay(),False); - m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), - (uint32_t)m_xWindow, - size); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglwindow.h b/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglwindow.h deleted file mode 100644 index a9642c581..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-egl/qwaylandxcompositeeglwindow.h +++ /dev/null @@ -1,79 +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 QWAYLANDXCOMPOSITEEGLWINDOW_H -#define QWAYLANDXCOMPOSITEEGLWINDOW_H - -#include "qwaylandwindow.h" -#include "qwaylandbuffer.h" - -#include "qwaylandxcompositeeglintegration.h" -#include "qwaylandxcompositeeglcontext.h" - -QT_BEGIN_NAMESPACE - -class QWaylandXCompositeEGLWindow : public QWaylandWindow -{ -public: - QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLIntegration *glxIntegration); - WindowType windowType() const; - - void setGeometry(const QRect &rect); - - EGLSurface eglSurface() const; - - QWaylandBuffer *buffer() { return m_buffer; } - -private: - void createEglSurface(); - - QWaylandXCompositeEGLIntegration *m_glxIntegration; - QWaylandXCompositeEGLContext *m_context; - QWaylandBuffer *m_buffer; - - Window m_xWindow; - EGLConfig m_config; - EGLSurface m_surface; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDXCOMPOSITEEGLWINDOW_H diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp b/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp index 5024f307d..17b20f987 100644 --- a/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp +++ b/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" FILE "qwayland-xcomposite-glx.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "qwayland-xcomposite-glx.json") public: QStringList keys() const; QPlatformIntegration *create(const QString&, const QStringList&); @@ -56,15 +56,15 @@ public: QStringList QWaylandIntegrationPlugin::keys() const { QStringList list; - list << "wayland-xcomposite"; + list << "wayland-xcomposite-glx"; return list; } QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "wayland-xcomposite") - return new QWaylandIntegration(); + if (system.toLower() == "wayland-xcomposite-glx") + return new QWaylandXCompositeGlxPlatformIntegration(); return 0; } diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.json b/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.json index 8ccd5b46b..0f4a3bf69 100644 --- a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.json +++ b/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.json @@ -1,3 +1,3 @@ { - "Keys": [ "wayland-xcomposite" ] + "Keys": [ "wayland-xcomposite-glx" ] } diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro b/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro index 6d7041085..dcf2e1b67 100644 --- a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro +++ b/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro @@ -1,25 +1,12 @@ PLUGIN_TYPE = platforms load(qt_plugin) -include(../wayland_common/wayland_common.pri) -include (../xcomposite_share/xcomposite_share.pri) +QT += waylandclient-private -OTHER_FILES += qwayland-xcomposite-glx.json +include(../../../hardwareintegration/client/xcomposite-glx/xcomposite-glx.pri) -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += xcomposite gl x11 -} else { - LIBS += -lXcomposite -lGL -lX11 -} +OTHER_FILES += qwayland-xcomposite-glx.json SOURCES += \ - qwaylandxcompositeglxcontext.cpp \ - qwaylandxcompositeglxintegration.cpp \ - qwaylandxcompositeglxwindow.cpp \ main.cpp -HEADERS += \ - qwaylandxcompositeglxcontext.h \ - qwaylandxcompositeglxintegration.h \ - qwaylandxcompositeglxwindow.h diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxcontext.cpp b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxcontext.cpp deleted file mode 100644 index 4ee022607..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxcontext.cpp +++ /dev/null @@ -1,109 +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 <QtCore/QDebug> - -#include "qwaylandxcompositeglxcontext.h" - -#include "qwaylandxcompositeglxwindow.h" - -#include <QRegion> - -QT_BEGIN_NAMESPACE - -QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen) - : m_display(display), - m_format(format) -{ - qDebug("creating XComposite-GLX context"); - - if (m_format.renderableType() == QSurfaceFormat::DefaultRenderableType) - m_format.setRenderableType(QSurfaceFormat::OpenGL); - - if (m_format.renderableType() != QSurfaceFormat::OpenGL) { - qWarning("Unsupported renderable type"); - return; - } - - GLXContext shareContext = share ? static_cast<QWaylandXCompositeGLXContext *>(share)->m_context : 0; - GLXFBConfig config = qglx_findConfig(display, screen, m_format, GLX_WINDOW_BIT | GLX_PIXMAP_BIT); - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display, config); - m_context = glXCreateContext(display, visualInfo, shareContext, true); - qglx_surfaceFormatFromGLXFBConfig(&m_format, display, config, m_context); -} - -bool QWaylandXCompositeGLXContext::makeCurrent(QPlatformSurface *surface) -{ - Window xWindow = static_cast<QWaylandXCompositeGLXWindow *>(surface)->xWindow(); - - return glXMakeCurrent(m_display, xWindow, m_context); -} - -void QWaylandXCompositeGLXContext::doneCurrent() -{ - glXMakeCurrent(m_display, 0, 0); -} - -void QWaylandXCompositeGLXContext::swapBuffers(QPlatformSurface *surface) -{ - QWaylandXCompositeGLXWindow *w = static_cast<QWaylandXCompositeGLXWindow *>(surface); - - QSize size = w->geometry().size(); - - glXSwapBuffers(m_display, w->xWindow()); - - w->attach(w->buffer(), 0, 0); - w->damage(QRect(QPoint(), size)); - w->commit(); - w->waitForFrameSync(); -} - -void (*QWaylandXCompositeGLXContext::getProcAddress(const QByteArray &procName)) () -{ - return glXGetProcAddress(reinterpret_cast<const GLubyte *>(procName.constData())); -} - -QSurfaceFormat QWaylandXCompositeGLXContext::format() const -{ - return m_format; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxcontext.h b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxcontext.h deleted file mode 100644 index de0311262..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxcontext.h +++ /dev/null @@ -1,78 +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 QWAYLANDXCOMPOSITEGLXCONTEXT_H -#define QWAYLANDXCOMPOSITEGLXCONTEXT_H - -#include <qpa/qplatformopenglcontext.h> - -#include "qwaylandxcompositeglxintegration.h" -#include <QtPlatformSupport/private/qglxconvenience_p.h> - -QT_BEGIN_NAMESPACE - -class QWaylandXCompositeGLXWindow; -class QWaylandShmBuffer; - -class QWaylandXCompositeGLXContext : public QPlatformOpenGLContext -{ -public: - QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen); - - QSurfaceFormat format() const; - - void swapBuffers(QPlatformSurface *surface); - - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); - - void (*getProcAddress(const QByteArray &procName)) (); - -private: - GLXContext m_context; - - Display *m_display; - QSurfaceFormat m_format; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDXCOMPOSITEGLXCONTEXT_H diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxintegration.cpp b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxintegration.cpp deleted file mode 100644 index 2e8b444f9..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxintegration.cpp +++ /dev/null @@ -1,139 +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 "qwaylandxcompositeglxintegration.h" - -#include "qwaylandxcompositeglxwindow.h" - -#include <QtCore/QDebug> - -#include "wayland-xcomposite-client-protocol.h" - -QT_BEGIN_NAMESPACE - -QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandXCompositeGLXIntegration(waylandDisplay); -} - -QWaylandXCompositeGLXIntegration::QWaylandXCompositeGLXIntegration(QWaylandDisplay *waylandDisplay) - : mWaylandDisplay(waylandDisplay) - , mWaylandComposite(0) - , mDisplay(0) - , mScreen(0) - , mRootWindow(0) -{ - qDebug() << "Using XComposite-GLX"; - waylandDisplay->addRegistryListener(QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal, this); -} - -QWaylandXCompositeGLXIntegration::~QWaylandXCompositeGLXIntegration() -{ - XCloseDisplay(mDisplay); -} - -void QWaylandXCompositeGLXIntegration::initialize() -{ -} - -QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandXCompositeGLXWindow(window, this); -} - -QPlatformOpenGLContext *QWaylandXCompositeGLXIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandXCompositeGLXContext(glFormat, share, mDisplay, mScreen); -} - -Display * QWaylandXCompositeGLXIntegration::xDisplay() const -{ - return mDisplay; -} - -int QWaylandXCompositeGLXIntegration::screen() const -{ - return mScreen; -} - -Window QWaylandXCompositeGLXIntegration::rootWindow() const -{ - return mRootWindow; -} - -QWaylandDisplay * QWaylandXCompositeGLXIntegration::waylandDisplay() const -{ - return mWaylandDisplay; -} -qt_xcomposite * QWaylandXCompositeGLXIntegration::waylandXComposite() const -{ - return mWaylandComposite; -} - -const struct qt_xcomposite_listener QWaylandXCompositeGLXIntegration::xcomposite_listener = { - QWaylandXCompositeGLXIntegration::rootInformation -}; - -void QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal(void *data, wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) -{ - Q_UNUSED(version); - if (interface == "qt_xcomposite") { - qDebug("XComposite-GLX: got qt_xcomposite global"); - QWaylandXCompositeGLXIntegration *integration = static_cast<QWaylandXCompositeGLXIntegration *>(data); - integration->mWaylandComposite = static_cast<struct qt_xcomposite *>(wl_registry_bind(registry, id, &qt_xcomposite_interface, 1)); - qt_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration); - } - -} - -void QWaylandXCompositeGLXIntegration::rootInformation(void *data, qt_xcomposite *xcomposite, const char *display_name, uint32_t root_window) -{ - 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); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxintegration.h b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxintegration.h deleted file mode 100644 index 90533db12..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxintegration.h +++ /dev/null @@ -1,107 +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 QWAYLANDXCOMPOSITEGLXINTEGRATION_H -#define QWAYLANDXCOMPOSITEGLXINTEGRATION_H - -#include "qwaylandglintegration.h" -#include "wayland-client.h" - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> -#include <QtGui/QWindow> - -#include <X11/Xlib.h> - -// avoid clashes with Qt::CursorShape -#ifdef CursorShape -# define X_CursorShape CursorShape -# undef CursorShape -#endif - -struct qt_xcomposite; - -QT_BEGIN_NAMESPACE - -class QWaylandXCompositeGLXIntegration : public QWaylandGLIntegration -{ -public: - QWaylandXCompositeGLXIntegration(QWaylandDisplay * waylandDispaly); - ~QWaylandXCompositeGLXIntegration(); - - void initialize(); - bool waitingForEvents() { return !mDisplay; } - - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - - QWaylandDisplay *waylandDisplay() const; - struct qt_xcomposite *waylandXComposite() const; - - Display *xDisplay() const; - int screen() const; - Window rootWindow() const; - - bool supportsThreadedOpenGL() const { return false; } - -private: - QWaylandDisplay *mWaylandDisplay; - struct qt_xcomposite *mWaylandComposite; - - Display *mDisplay; - int mScreen; - Window mRootWindow; - - static void wlDisplayHandleGlobal(void *data, struct wl_registry *registry, uint32_t id, - const QString &interface, uint32_t version); - - static const struct qt_xcomposite_listener xcomposite_listener; - static void rootInformation(void *data, - struct qt_xcomposite *xcomposite, - const char *display_name, - uint32_t root_window); -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDXCOMPOSITEGLXINTEGRATION_H diff --git a/src/plugins/platforms/xcomposite_share/qwaylandxcompositebuffer.h b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h index e70012419..fe8c5b7c5 100644 --- a/src/plugins/platforms/xcomposite_share/qwaylandxcompositebuffer.h +++ b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 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. @@ -39,29 +39,26 @@ ** ****************************************************************************/ -#ifndef QWAYLANDXCOMPOSITEBUFFER_H -#define QWAYLANDXCOMPOSITEBUFFER_H +#ifndef QWAYLANDXCOMPOSITEGLXPLATFORMINTEGRATION_H +#define QWAYLANDXCOMPOSITEGLXPLATFORMINTEGRATION_H -#include "qwaylandbuffer.h" -#include <stdint.h> +#include <QtWaylandClient/qwaylandintegration.h> -struct qt_xcomposite; -struct wl_visual; +#include "qwaylandxcompositeglxintegration.h" -QT_BEGIN_NAMESPACE - -class QWaylandXCompositeBuffer : public QWaylandBuffer +class QWaylandXCompositeGlxPlatformIntegration : public QWaylandIntegration { public: - QWaylandXCompositeBuffer(qt_xcomposite *xcomposite, - uint32_t window, - const QSize &size); + QWaylandXCompositeGlxPlatformIntegration() + : QWaylandIntegration() + , m_gl_integration(new QWaylandXCompositeGLXIntegration(display())) + { } + + QWaylandGLIntegration *glIntegration() const Q_DECL_OVERRIDE + { return m_gl_integration; } - QSize size() const; private: - QSize mSize; + QWaylandGLIntegration *m_gl_integration; }; -QT_END_NAMESPACE - -#endif // QWAYLANDXCOMPOSITEBUFFER_H +#endif diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxwindow.cpp b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxwindow.cpp deleted file mode 100644 index f33790f33..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxwindow.cpp +++ /dev/null @@ -1,123 +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 "qwaylandxcompositeglxwindow.h" -#include "qwaylandxcompositebuffer.h" - -#include <QtCore/QDebug> - -#include "wayland-xcomposite-client-protocol.h" -#include <QtGui/QRegion> - -#include <X11/extensions/Xcomposite.h> - -QT_BEGIN_NAMESPACE - -QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration) - : QWaylandWindow(window) - , m_glxIntegration(glxIntegration) - , m_xWindow(0) - , m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->format(), GLX_WINDOW_BIT | GLX_PIXMAP_BIT)) - , m_buffer(0) -{ -} - -QWaylandWindow::WindowType QWaylandXCompositeGLXWindow::windowType() const -{ - //yeah. this type needs a new name - return QWaylandWindow::Egl; -} - -void QWaylandXCompositeGLXWindow::setGeometry(const QRect &rect) -{ - QWaylandWindow::setGeometry(rect); - - if (m_xWindow) { - delete m_buffer; - - XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow); - m_xWindow = 0; - } -} - -Window QWaylandXCompositeGLXWindow::xWindow() const -{ - if (!m_xWindow) - const_cast<QWaylandXCompositeGLXWindow *>(this)->createSurface(); - - return m_xWindow; -} - -void QWaylandXCompositeGLXWindow::createSurface() -{ - QSize size(geometry().size()); - if (size.isEmpty()) { - //QGLWidget wants a context for a window without geometry - 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); - - XSetWindowAttributes a; - a.background_pixel = WhitePixel(m_glxIntegration->xDisplay(), m_glxIntegration->screen()); - a.border_pixel = BlackPixel(m_glxIntegration->xDisplay(), m_glxIntegration->screen()); - a.colormap = cmap; - m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(), - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWBackPixel|CWBorderPixel|CWColormap, &a); - - XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual); - XMapWindow(m_glxIntegration->xDisplay(), m_xWindow); - - XSync(m_glxIntegration->xDisplay(), False); - m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), - (uint32_t)m_xWindow, - size); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxwindow.h b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxwindow.h deleted file mode 100644 index 88f417f2d..000000000 --- a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxwindow.h +++ /dev/null @@ -1,80 +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 QWAYLANDXCOMPOSITEGLXWINDOW_H -#define QWAYLANDXCOMPOSITEGLXWINDOW_H - -#include "qwaylandwindow.h" -#include "qwaylandxcompositeglxintegration.h" -#include "qwaylandxcompositeglxcontext.h" - -#include <QtCore/QWaitCondition> - -#include "qwaylandbuffer.h" - -QT_BEGIN_NAMESPACE - -class QWaylandXCompositeGLXWindow : public QWaylandWindow -{ -public: - QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration); - WindowType windowType() const; - - void setGeometry(const QRect &rect); - - Window xWindow() const; - - QWaylandBuffer *buffer() { return m_buffer; } - -private: - void createSurface(); - - QWaylandXCompositeGLXIntegration *m_glxIntegration; - - Window m_xWindow; - GLXFBConfig m_config; - - QWaylandBuffer *m_buffer; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDXCOMPOSITEGLXWINDOW_H diff --git a/src/plugins/platforms/wayland_common/qwaylandbuffer.h b/src/plugins/platforms/wayland_common/qwaylandbuffer.h deleted file mode 100644 index eee648561..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandbuffer.h +++ /dev/null @@ -1,66 +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 QWAYLANDBUFFER_H -#define QWAYLANDBUFFER_H - -#include <QtCore/QSize> -#include <QtCore/QRect> - -#include <wayland-client.h> -#include <wayland-client-protocol.h> - -QT_BEGIN_NAMESPACE - -class QWaylandBuffer { -public: - QWaylandBuffer() { } - virtual ~QWaylandBuffer() { } - wl_buffer *buffer() {return mBuffer;} - virtual QSize size() const = 0; - -protected: - struct wl_buffer *mBuffer; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDBUFFER_H diff --git a/src/plugins/platforms/wayland_common/qwaylandclipboard.cpp b/src/plugins/platforms/wayland_common/qwaylandclipboard.cpp deleted file mode 100644 index 4cf055d30..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandclipboard.cpp +++ /dev/null @@ -1,85 +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 "qwaylandclipboard.h" -#include "qwaylanddisplay.h" -#include "qwaylandinputdevice.h" -#include "qwaylanddataoffer.h" -#include "qwaylanddatasource.h" -#include "qwaylanddatadevicemanager.h" - -QT_BEGIN_NAMESPACE - -QWaylandClipboard::QWaylandClipboard(QWaylandDisplay *display) - : mDisplay(display) -{ -} - -QWaylandClipboard::~QWaylandClipboard() -{ -} - -QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode) -{ - Q_ASSERT(mode == QClipboard::Clipboard); - if (!mDisplay->dndSelectionHandler()) - return 0; - - QWaylandDataSource *transfer_source = mDisplay->dndSelectionHandler()->selectionTransferSource(); - if (transfer_source) { //if we have the keyboard focus and selectionTransferSource then we own the clipboard - return transfer_source->mimeData(); - } - return mDisplay->dndSelectionHandler()->selectionTransfer(); -} - -void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) -{ - Q_ASSERT(mode == QClipboard::Clipboard); - if (mDisplay->dndSelectionHandler()) - mDisplay->dndSelectionHandler()->createAndSetSelectionSource(data,mode); -} - -bool QWaylandClipboard::supportsMode(QClipboard::Mode mode) const -{ - return mode == QClipboard::Clipboard; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandclipboard.h b/src/plugins/platforms/wayland_common/qwaylandclipboard.h deleted file mode 100644 index a8f52e107..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandclipboard.h +++ /dev/null @@ -1,71 +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 QWAYLANDCLIPBOARD_H -#define QWAYLANDCLIPBOARD_H - -#include <qpa/qplatformclipboard.h> -#include <QtCore/QVariant> - -QT_BEGIN_NAMESPACE - -class QWaylandDisplay; - -class QWaylandClipboard : public QPlatformClipboard -{ -public: - QWaylandClipboard(QWaylandDisplay *display); - - ~QWaylandClipboard(); - - QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); - void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); - bool supportsMode(QClipboard::Mode mode) const; - - QVariant retrieveData(const QString &mimeType, QVariant::Type type) const; - -private: - QWaylandDisplay *mDisplay; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDCLIPBOARD_H diff --git a/src/plugins/platforms/wayland_common/qwaylandcursor.cpp b/src/plugins/platforms/wayland_common/qwaylandcursor.cpp deleted file mode 100644 index e0abba304..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandcursor.cpp +++ /dev/null @@ -1,297 +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 "qwaylandcursor.h" - -#include "qwaylanddisplay.h" -#include "qwaylandinputdevice.h" -#include "qwaylandscreen.h" -#include "qwaylandshmbackingstore.h" - -#include <QtGui/QImageReader> -#include <QDebug> - -#include <wayland-cursor.h> - -QT_BEGIN_NAMESPACE - -QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) - : mDisplay(screen->display()) -{ - //TODO: Make wl_cursor_theme_load arguments configurable here - QByteArray cursorTheme = qgetenv("XCURSOR_THEME"); - if (cursorTheme.isEmpty()) - cursorTheme = QByteArray("default"); - QByteArray cursorSizeFromEnv = qgetenv("XCURSOR_SIZE"); - bool hasCursorSize = false; - int cursorSize = cursorSizeFromEnv.toInt(&hasCursorSize); - if (!hasCursorSize || cursorSize <= 0) - cursorSize = 32; - mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm()); - initCursorMap(); -} - -QWaylandCursor::~QWaylandCursor() -{ - wl_cursor_theme_destroy(mCursorTheme); -} - -struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape) -{ - struct wl_cursor *waylandCursor = 0; - - /* Hide cursor */ - if (newShape == Qt::BlankCursor) - { - mDisplay->setCursor(NULL, NULL); - return NULL; - } - - if (newShape < Qt::BitmapCursor) { - waylandCursor = requestCursor((WaylandCursor)newShape); - } else if (newShape == Qt::BitmapCursor) { - //TODO: Bitmap cursor logic - } else { - //TODO: Custom cursor logic (for resize arrows) - } - - if (!waylandCursor) { - qDebug("Could not find cursor for shape %d", newShape); - return NULL; - } - - struct wl_cursor_image *image = waylandCursor->images[0]; - struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); - if (!buffer) { - qDebug("Could not find buffer for cursor"); - return NULL; - } - - return image; -} - -void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) -{ - Q_UNUSED(window) - - const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor; - - struct wl_cursor_image *image = cursorImage(newShape); - if (!image) { - return; - } - - struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); - mDisplay->setCursor(buffer, image); -} - -void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) -{ - /* Qt doesn't tell us which input device we should set the cursor - * for, so set it for all devices. */ - for (int i = 0; i < mInputDevices.count(); i++) { - QWaylandInputDevice *inputDevice = mInputDevices.at(i); - inputDevice->setCursor(buffer, image); - } -} - -void QWaylandCursor::pointerEvent(const QMouseEvent &event) -{ - mLastPos = event.globalPos(); -} - -QPoint QWaylandCursor::pos() const -{ - return mLastPos; -} - -void QWaylandCursor::setPos(const QPoint &pos) -{ - Q_UNUSED(pos); - qWarning() << "QWaylandCursor::setPos: not implemented"; -} - -wl_cursor *QWaylandCursor::requestCursor(WaylandCursor shape) -{ - struct wl_cursor *cursor = mCursors.value(shape, 0); - - //If the cursor has not been loaded already, load it - if (!cursor) { - QList<QByteArray> cursorNames = mCursorNamesMap.values(shape); - foreach (QByteArray name, cursorNames) { - cursor = wl_cursor_theme_get_cursor(mCursorTheme, name.constData()); - if (cursor) { - mCursors.insert(shape, cursor); - break; - } - } - } - - //If there still no cursor for a shape, use the default cursor - if (!cursor && shape != ArrowCursor) { - cursor = requestCursor(ArrowCursor); - } - - return cursor; -} - - -void QWaylandCursor::initCursorMap() -{ - //Fill the cursor name map will the table of xcursor names - mCursorNamesMap.insert(ArrowCursor, "left_ptr"); - mCursorNamesMap.insert(ArrowCursor, "default"); - mCursorNamesMap.insert(ArrowCursor, "top_left_arrow"); - mCursorNamesMap.insert(ArrowCursor, "left_arrow"); - - mCursorNamesMap.insert(UpArrowCursor, "up_arrow"); - - mCursorNamesMap.insert(CrossCursor, "cross"); - - mCursorNamesMap.insert(WaitCursor, "wait"); - mCursorNamesMap.insert(WaitCursor, "watch"); - mCursorNamesMap.insert(WaitCursor, "0426c94ea35c87780ff01dc239897213"); - - mCursorNamesMap.insert(IBeamCursor, "ibeam"); - mCursorNamesMap.insert(IBeamCursor, "text"); - mCursorNamesMap.insert(IBeamCursor, "xterm"); - - mCursorNamesMap.insert(SizeVerCursor, "size_ver"); - mCursorNamesMap.insert(SizeVerCursor, "ns-resize"); - mCursorNamesMap.insert(SizeVerCursor, "v_double_arrow"); - mCursorNamesMap.insert(SizeVerCursor, "00008160000006810000408080010102"); - - mCursorNamesMap.insert(SizeHorCursor, "size_hor"); - mCursorNamesMap.insert(SizeHorCursor, "ew-resize"); - mCursorNamesMap.insert(SizeHorCursor, "h_double_arrow"); - mCursorNamesMap.insert(SizeHorCursor, "028006030e0e7ebffc7f7070c0600140"); - - mCursorNamesMap.insert(SizeBDiagCursor, "size_bdiag"); - mCursorNamesMap.insert(SizeBDiagCursor, "nesw-resize"); - mCursorNamesMap.insert(SizeBDiagCursor, "50585d75b494802d0151028115016902"); - mCursorNamesMap.insert(SizeBDiagCursor, "fcf1c3c7cd4491d801f1e1c78f100000"); - - mCursorNamesMap.insert(SizeFDiagCursor, "size_fdiag"); - mCursorNamesMap.insert(SizeFDiagCursor, "nwse-resize"); - mCursorNamesMap.insert(SizeFDiagCursor, "38c5dff7c7b8962045400281044508d2"); - mCursorNamesMap.insert(SizeFDiagCursor, "c7088f0f3e6c8088236ef8e1e3e70000"); - - mCursorNamesMap.insert(SizeAllCursor, "size_all"); - - mCursorNamesMap.insert(SplitVCursor, "split_v"); - mCursorNamesMap.insert(SplitVCursor, "row-resize"); - mCursorNamesMap.insert(SplitVCursor, "sb_v_double_arrow"); - mCursorNamesMap.insert(SplitVCursor, "2870a09082c103050810ffdffffe0204"); - mCursorNamesMap.insert(SplitVCursor, "c07385c7190e701020ff7ffffd08103c"); - - mCursorNamesMap.insert(SplitHCursor, "split_h"); - mCursorNamesMap.insert(SplitHCursor, "col-resize"); - mCursorNamesMap.insert(SplitHCursor, "sb_h_double_arrow"); - mCursorNamesMap.insert(SplitHCursor, "043a9f68147c53184671403ffa811cc5"); - mCursorNamesMap.insert(SplitHCursor, "14fef782d02440884392942c11205230"); - - mCursorNamesMap.insert(PointingHandCursor, "pointing_hand"); - mCursorNamesMap.insert(PointingHandCursor, "pointer"); - mCursorNamesMap.insert(PointingHandCursor, "hand1"); - mCursorNamesMap.insert(PointingHandCursor, "e29285e634086352946a0e7090d73106"); - - mCursorNamesMap.insert(ForbiddenCursor, "forbidden"); - mCursorNamesMap.insert(ForbiddenCursor, "not-allowed"); - mCursorNamesMap.insert(ForbiddenCursor, "crossed_circle"); - mCursorNamesMap.insert(ForbiddenCursor, "circle"); - mCursorNamesMap.insert(ForbiddenCursor, "03b6e0fcb3499374a867c041f52298f0"); - - mCursorNamesMap.insert(WhatsThisCursor, "whats_this"); - mCursorNamesMap.insert(WhatsThisCursor, "help"); - mCursorNamesMap.insert(WhatsThisCursor, "question_arrow"); - mCursorNamesMap.insert(WhatsThisCursor, "5c6cd98b3f3ebcb1f9c7f1c204630408"); - mCursorNamesMap.insert(WhatsThisCursor, "d9ce0ab605698f320427677b458ad60b"); - - mCursorNamesMap.insert(BusyCursor, "left_ptr_watch"); - mCursorNamesMap.insert(BusyCursor, "half-busy"); - mCursorNamesMap.insert(BusyCursor, "progress"); - mCursorNamesMap.insert(BusyCursor, "00000000000000020006000e7e9ffc3f"); - mCursorNamesMap.insert(BusyCursor, "08e8e1c95fe2fc01f976f1e063a24ccd"); - - mCursorNamesMap.insert(OpenHandCursor, "openhand"); - mCursorNamesMap.insert(OpenHandCursor, "fleur"); - mCursorNamesMap.insert(OpenHandCursor, "5aca4d189052212118709018842178c0"); - mCursorNamesMap.insert(OpenHandCursor, "9d800788f1b08800ae810202380a0822"); - - mCursorNamesMap.insert(ClosedHandCursor, "closedhand"); - mCursorNamesMap.insert(ClosedHandCursor, "grabbing"); - mCursorNamesMap.insert(ClosedHandCursor, "208530c400c041818281048008011002"); - - mCursorNamesMap.insert(DragCopyCursor, "dnd-copy"); - mCursorNamesMap.insert(DragCopyCursor, "copy"); - - mCursorNamesMap.insert(DragMoveCursor, "dnd-move"); - mCursorNamesMap.insert(DragMoveCursor, "move"); - - mCursorNamesMap.insert(DragLinkCursor, "dnd-link"); - mCursorNamesMap.insert(DragLinkCursor, "link"); - - mCursorNamesMap.insert(ResizeNorthCursor, "n-resize"); - mCursorNamesMap.insert(ResizeNorthCursor, "top_side"); - - mCursorNamesMap.insert(ResizeSouthCursor, "s-resize"); - mCursorNamesMap.insert(ResizeSouthCursor, "bottom_side"); - - mCursorNamesMap.insert(ResizeEastCursor, "e-resize"); - mCursorNamesMap.insert(ResizeEastCursor, "right_side"); - - mCursorNamesMap.insert(ResizeWestCursor, "w-resize"); - mCursorNamesMap.insert(ResizeWestCursor, "left_side"); - - mCursorNamesMap.insert(ResizeNorthWestCursor, "nw-resize"); - mCursorNamesMap.insert(ResizeNorthWestCursor, "top_left_corner"); - - mCursorNamesMap.insert(ResizeSouthEastCursor, "se-resize"); - mCursorNamesMap.insert(ResizeSouthEastCursor, "bottom_right_corner"); - - mCursorNamesMap.insert(ResizeNorthEastCursor, "ne-resize"); - mCursorNamesMap.insert(ResizeNorthEastCursor, "top_right_corner"); - - mCursorNamesMap.insert(ResizeSouthWestCursor, "sw-resize"); - mCursorNamesMap.insert(ResizeSouthWestCursor, "bottom_left_corner"); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandcursor.h b/src/plugins/platforms/wayland_common/qwaylandcursor.h deleted file mode 100644 index ceb6d7488..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandcursor.h +++ /dev/null @@ -1,115 +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 QWAYLANDCURSOR_H -#define QWAYLANDCURSOR_H - -#include <qpa/qplatformcursor.h> -#include <QMap> - -struct wl_cursor; -struct wl_cursor_image; -struct wl_cursor_theme; - -QT_BEGIN_NAMESPACE - -class QWaylandDisplay; -class QWaylandScreen; - -class QWaylandCursor : public QPlatformCursor -{ -public: - QWaylandCursor(QWaylandScreen *screen); - ~QWaylandCursor(); - - void changeCursor(QCursor *cursor, QWindow *window); - void pointerEvent(const QMouseEvent &event); - QPoint pos() const; - void setPos(const QPoint &pos); - - struct wl_cursor_image *cursorImage(Qt::CursorShape shape); - -private: - enum WaylandCursor { - ArrowCursor = Qt::ArrowCursor, - UpArrowCursor, - CrossCursor, - WaitCursor, - IBeamCursor, - SizeVerCursor, - SizeHorCursor, - SizeBDiagCursor, - SizeFDiagCursor, - SizeAllCursor, - BlankCursor, - SplitVCursor, - SplitHCursor, - PointingHandCursor, - ForbiddenCursor, - WhatsThisCursor, - BusyCursor, - OpenHandCursor, - ClosedHandCursor, - DragCopyCursor, - DragMoveCursor, - DragLinkCursor, - ResizeNorthCursor = Qt::CustomCursor + 1, - ResizeSouthCursor, - ResizeEastCursor, - ResizeWestCursor, - ResizeNorthWestCursor, - ResizeSouthEastCursor, - ResizeNorthEastCursor, - ResizeSouthWestCursor - }; - - struct wl_cursor* requestCursor(WaylandCursor shape); - void initCursorMap(); - QWaylandDisplay *mDisplay; - struct wl_cursor_theme *mCursorTheme; - QPoint mLastPos; - QMap<WaylandCursor, wl_cursor *> mCursors; - QMultiMap<WaylandCursor, QByteArray> mCursorNamesMap; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDCURSOR_H diff --git a/src/plugins/platforms/wayland_common/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland_common/qwaylanddatadevicemanager.cpp deleted file mode 100644 index 8674aae9e..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddatadevicemanager.cpp +++ /dev/null @@ -1,326 +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 "qwaylanddatadevicemanager.h" - -#include "qwaylandinputdevice.h" -#include "qwaylanddataoffer.h" -#include "qwaylanddatasource.h" -#include "qwaylandshmbackingstore.h" - -#include <wayland-client-protocol.h> -#include <wayland-client.h> - -#include <QtGui/QGuiApplication> -#include <QtGui/private/qguiapplication_p.h> -#include <qpa/qplatformclipboard.h> -#include <QtGui/QPainter> - -#include <qpa/qwindowsysteminterface.h> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -void QWaylandDataDeviceManager::data_offer(void *data, - struct wl_data_device *data_device, - struct wl_data_offer *id) -{ - Q_UNUSED(data_device); - QWaylandDataDeviceManager *handler = static_cast<QWaylandDataDeviceManager *>(data); - - new QWaylandDataOffer(handler->display(),id); -} - -void QWaylandDataDeviceManager::enter(void *data, - struct wl_data_device *wl_data_device, - uint32_t time, - struct wl_surface *surface, - wl_fixed_t x, - wl_fixed_t y, - struct wl_data_offer *id) -{ - - Q_UNUSED(wl_data_device); - Q_UNUSED(x); - Q_UNUSED(y); - QWaylandDataDeviceManager *data_device_manager = static_cast<QWaylandDataDeviceManager *>(data); - if (time < data_device_manager->m_drag_last_event_time) - return; - data_device_manager->m_drag_last_event_time = time; - - data_device_manager->m_drag_current_event_window = QWaylandWindow::fromWlSurface(surface); - if (!surface) - return; - QWaylandDataOffer *offer = static_cast<QWaylandDataOffer *>(wl_data_offer_get_user_data(id)); - if (!offer) - return; - -// QPoint point(x,y); -// Qt::DropActions allActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; -// QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(data_device_manager->m_drag_current_event_window->window(), -// offer,point,allActions); -// data_device_manager->m_drag_can_drop = response.accepted(); - data_device_manager->m_drag_data_offer = offer; - if (data_device_manager->m_drag_can_drop) { - const char *first_offer = qPrintable(offer->formats_sys().at(0)); - wl_data_offer_accept(offer->handle(),QWaylandDisplay::currentTimeMillisec(),first_offer); - } else { - wl_data_offer_accept(offer->handle(),QWaylandDisplay::currentTimeMillisec(),0); - } -} - -void QWaylandDataDeviceManager::leave(void *data, - struct wl_data_device *wl_data_device) -{ - Q_UNUSED(wl_data_device); - QWaylandDataDeviceManager *data_device_manager = static_cast<QWaylandDataDeviceManager *>(data); -// QWindowSystemInterface::handleDrag(data_device_manager->m_drag_current_event_window->window(),0,QPoint(0,0),Qt::IgnoreAction); - data_device_manager->m_drag_can_drop = false; - data_device_manager->m_drag_data_offer = 0; - data_device_manager->m_drag_last_event_time = 0; - data_device_manager->m_drag_current_event_window = 0; - data_device_manager->m_drag_position = QPoint(); -} - -void QWaylandDataDeviceManager::motion(void *data, - struct wl_data_device *wl_data_device, - uint32_t time, - wl_fixed_t x, - wl_fixed_t y) -{ - Q_UNUSED(wl_data_device); - QWaylandDataDeviceManager *data_device_manager = static_cast<QWaylandDataDeviceManager *>(data); - if (time < data_device_manager->m_drag_last_event_time) - return; - data_device_manager->m_drag_position = QPoint(wl_fixed_to_int(x), wl_fixed_to_int(y)); - -// Qt::DropActions allActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; -// QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(data_device_manager->m_drag_current_event_window->window(), -// data_device_manager->m_drag_data_offer, data_device_manager->m_drag_position ,allActions); -// data_device_manager->m_drag_can_drop = response.accepted(); - const char *offerMime = 0; - if (data_device_manager->m_drag_can_drop) { - offerMime = qPrintable(data_device_manager->m_drag_data_offer->formats_sys().at(0)); - } - wl_data_offer_accept(data_device_manager->m_drag_data_offer->handle(),QWaylandDisplay::currentTimeMillisec(),offerMime); -} - -void QWaylandDataDeviceManager::drop(void *data, - struct wl_data_device *wl_data_device) -{ - Q_UNUSED(wl_data_device); - QWaylandDataDeviceManager *data_device_manager = static_cast<QWaylandDataDeviceManager *>(data); - QWindow *window = data_device_manager->m_drag_current_event_window->window(); - QMimeData *mime = data_device_manager->m_drag_data_offer; -// QPoint point = data_device_manager->m_drag_position; -// Qt::DropActions allActions = Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; - - Q_UNUSED(window); - Q_UNUSED(mime); -// QWindowSystemInterface::handleDrop(window,mime,point,allActions); -} - - -void QWaylandDataDeviceManager::selection(void *data, - struct wl_data_device *wl_data_device, - struct wl_data_offer *id) -{ - Q_UNUSED(wl_data_device); - - QWaylandDataDeviceManager *handler = static_cast<QWaylandDataDeviceManager *>(data); - QWaylandDataOffer *mime = handler->m_selection_data_offer; - delete mime; - QWaylandDataSource *transfer_source = handler->m_selection_data_source; - delete transfer_source; - handler->m_selection_data_source = 0; - - if (id) { - mime = static_cast<QWaylandDataOffer *>(wl_data_offer_get_user_data(id)); - handler->m_selection_data_offer = mime; - } else { - handler->m_selection_data_offer = 0; - } - - QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard); -} - -const struct wl_data_device_listener QWaylandDataDeviceManager::transfer_device_listener = { - QWaylandDataDeviceManager::data_offer, - QWaylandDataDeviceManager::enter, - QWaylandDataDeviceManager::leave, - QWaylandDataDeviceManager::motion, - QWaylandDataDeviceManager::drop, - QWaylandDataDeviceManager::selection -}; - -QWaylandDataDeviceManager::QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id) - : m_display(display) - , m_selection_data_offer(0) - , m_selection_data_source(0) - , m_drag_data_offer(0) - , m_drag_data_source(0) - , m_drag_surface(0) - , m_drag_icon_surface(0) - , m_drag_icon_buffer(0) - , m_drag_can_drop(false) -{ - m_data_device_manager = static_cast<struct wl_data_device_manager *>(wl_registry_bind(display->wl_registry(),id,&wl_data_device_manager_interface,1)); - - // Create transfer devices for all input devices. - // ### This only works if we get the global before all devices and is surely wrong when hotplugging. - QList<QWaylandInputDevice *> inputDevices = m_display->inputDevices(); - for (int i = 0; i < inputDevices.size();i++) { - inputDevices.at(i)->setTransferDevice(getDataDevice(inputDevices.at(i))); - } -} - -QWaylandDataDeviceManager::~QWaylandDataDeviceManager() -{ - wl_data_device_manager_destroy(m_data_device_manager); -} - -struct wl_data_device *QWaylandDataDeviceManager::getDataDevice(QWaylandInputDevice *inputDevice) -{ - struct wl_data_device *transfer_device = wl_data_device_manager_get_data_device(m_data_device_manager, - inputDevice->wl_seat()); - wl_data_device_add_listener(transfer_device,&transfer_device_listener,this); - - return transfer_device; -} - -QWaylandDataOffer *QWaylandDataDeviceManager::selectionTransfer() const -{ - return m_selection_data_offer; -} - -void QWaylandDataDeviceManager::createAndSetDrag(QDrag *drag) -{ - QWaylandInputDevice *inputDevice = m_display->lastKeyboardFocusInputDevice(); - if (!inputDevice) - return; - - if (m_drag_data_source) { - qDebug() << "QWaylandDndSelectionHandler::createAndSetDrag: Allready have a valid drag"; - delete m_drag_data_source; - } - - delete m_drag_data_offer; - m_drag_data_offer = 0; - - m_drag_data_source = new QWaylandDataSource(this,drag->mimeData()); - - struct wl_data_device *transfer_device = inputDevice->transferDevice(); - m_drag_surface = m_display->createSurface(this); - QPixmap pixmap = drag->pixmap(); - if (pixmap.isNull()) { -// pixmap = QPlatformDrag::defaultPixmap(); - } - - m_drag_icon_buffer = new QWaylandShmBuffer(m_display, pixmap.size(), QImage::Format_ARGB32_Premultiplied); - - { - QPainter p(m_drag_icon_buffer->image()); - p.drawPixmap(0,0,pixmap); - } - - m_drag_icon_surface = m_display->compositor()->create_surface(); - wl_surface_attach(m_drag_icon_surface, m_drag_icon_buffer->buffer(), -drag->hotSpot().x(), -drag->hotSpot().y()); - - wl_data_device_start_drag(transfer_device, m_drag_data_source->handle(), m_drag_surface, m_drag_icon_surface, QWaylandDisplay::currentTimeMillisec()); -} - -QMimeData *QWaylandDataDeviceManager::dragMime() const -{ - if (m_drag_data_offer) { - return m_drag_data_offer; - } else if (m_drag_data_source){ - return m_drag_data_source->mimeData(); - } - return 0; -} - -bool QWaylandDataDeviceManager::canDropDrag() const -{ - return m_drag_can_drop; -} - -void QWaylandDataDeviceManager::cancelDrag() -{ - wl_data_source_destroy(m_drag_data_source->handle() ); - wl_surface_destroy(m_drag_icon_surface); - m_drag_data_source = 0; -} - -void QWaylandDataDeviceManager::createAndSetSelectionSource(QMimeData *mimeData, QClipboard::Mode mode) -{ - Q_UNUSED(mode); - QWaylandDataSource *transfer_source = m_selection_data_source; - delete transfer_source; - - transfer_source = new QWaylandDataSource(this,mimeData); - m_selection_data_source = transfer_source; - QWaylandInputDevice *inputDevice = m_display->lastKeyboardFocusInputDevice(); - if (!inputDevice) - inputDevice = m_display->inputDevices().first(); // try to survive in apps without any surfaces - struct wl_data_device *transfer_device = inputDevice->transferDevice(); - wl_data_device_set_selection(transfer_device,transfer_source->handle(),QWaylandDisplay::currentTimeMillisec()); - - QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard); -} - -QWaylandDataSource *QWaylandDataDeviceManager::selectionTransferSource() -{ - return m_selection_data_source; -} - - -QWaylandDisplay * QWaylandDataDeviceManager::display() const -{ - return m_display; -} - -struct wl_data_device_manager *QWaylandDataDeviceManager::handle() const -{ - return m_data_device_manager; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylanddatadevicemanager.h b/src/plugins/platforms/wayland_common/qwaylanddatadevicemanager.h deleted file mode 100644 index 101f78448..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddatadevicemanager.h +++ /dev/null @@ -1,127 +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 QWAYLANDDATADEVICEMANAGER_H -#define QWAYLANDDATADEVICEMANAGER_H - -#include "qwaylanddisplay.h" - -#include <QtCore/QMap> -#include <QtCore/QMimeData> -#include <QtCore/QStringList> -#include <QtGui/QClipboard> - -QT_BEGIN_NAMESPACE - -class QWaylandDataOffer; -class QWaylandDataSource; -class QDrag; -class QWaylandShmBuffer; -class QWaylandWindow; - -class QWaylandDataDeviceManager -{ -public: - QWaylandDataDeviceManager(QWaylandDisplay *display, uint32_t id); - ~QWaylandDataDeviceManager(); - - struct wl_data_device *getDataDevice(QWaylandInputDevice *inputDevice); - - QWaylandDataOffer *selectionTransfer() const; - - void createAndSetDrag(QDrag *drag); - QMimeData *dragMime() const; - bool canDropDrag() const; - void cancelDrag(); - - void createAndSetSelectionSource(QMimeData *mimeData, QClipboard::Mode mode); - QWaylandDataSource *selectionTransferSource(); - - QWaylandDisplay *display()const; - - struct wl_data_device_manager *handle() const; - -private: - struct wl_data_device_manager *m_data_device_manager; - QWaylandDisplay *m_display; - - QWaylandDataOffer *m_selection_data_offer; - QWaylandDataSource *m_selection_data_source; - - QWaylandDataOffer *m_drag_data_offer; - QWaylandDataSource *m_drag_data_source; - QWaylandWindow *m_drag_current_event_window; - wl_surface *m_drag_surface; - wl_surface *m_drag_icon_surface; - QWaylandShmBuffer *m_drag_icon_buffer; - bool m_drag_can_drop; - uint32_t m_drag_last_event_time; - QPoint m_drag_position; - - static void data_offer(void *data, - struct wl_data_device *wl_data_device, - struct wl_data_offer *id); - static void enter(void *data, - struct wl_data_device *wl_data_device, - uint32_t time, - struct wl_surface *surface, - wl_fixed_t x, - wl_fixed_t y, - struct wl_data_offer *id); - static void leave(void *data, - struct wl_data_device *wl_data_device); - static void motion(void *data, - struct wl_data_device *wl_data_device, - uint32_t time, - wl_fixed_t x, - wl_fixed_t y); - static void drop(void *data, - struct wl_data_device *wl_data_device); - static void selection(void *data, - struct wl_data_device *wl_data_device, - struct wl_data_offer *id); - - static const struct wl_data_device_listener transfer_device_listener; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDDATADEVICEMANAGER_H diff --git a/src/plugins/platforms/wayland_common/qwaylanddataoffer.cpp b/src/plugins/platforms/wayland_common/qwaylanddataoffer.cpp deleted file mode 100644 index d98cfc2ab..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddataoffer.cpp +++ /dev/null @@ -1,147 +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 "qwaylanddataoffer.h" -#include "qwaylanddatadevicemanager.h" - -#include <QtGui/private/qguiapplication_p.h> -#include <qpa/qplatformclipboard.h> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -void QWaylandDataOffer::offer_sync_callback(void *data, - struct wl_callback *callback, - uint32_t time) -{ - Q_UNUSED(time); - QWaylandDataOffer *mime = static_cast<QWaylandDataOffer *>(data); - if (mime->m_receiveSyncCallback == callback) { - mime->m_receiveSyncCallback = 0; - wl_callback_destroy(callback); - } -} - -const struct wl_callback_listener QWaylandDataOffer::offer_sync_callback_listener = { - QWaylandDataOffer::offer_sync_callback -}; - -void QWaylandDataOffer::offer(void *data, - struct wl_data_offer *wl_data_offer, - const char *type) -{ - Q_UNUSED(wl_data_offer); - - QWaylandDataOffer *data_offer = static_cast<QWaylandDataOffer *>(data); - - if (!data_offer->m_receiveSyncCallback) { - data_offer->m_receiveSyncCallback = wl_display_sync(data_offer->m_display->wl_display()); - wl_callback_add_listener(data_offer->m_receiveSyncCallback, &offer_sync_callback_listener, data_offer); - } - - data_offer->m_offered_mime_types.append(QString::fromLocal8Bit(type)); -// qDebug() << data_offer->m_offered_mime_types; -} - -const struct wl_data_offer_listener QWaylandDataOffer::data_offer_listener = { - QWaylandDataOffer::offer -}; - -QWaylandDataOffer::QWaylandDataOffer(QWaylandDisplay *display, struct wl_data_offer *data_offer) - : m_display(display) - , m_receiveSyncCallback(0) -{ - m_data_offer = data_offer; - wl_data_offer_set_user_data(m_data_offer,this); - wl_data_offer_add_listener(m_data_offer,&data_offer_listener,this); -} - -QWaylandDataOffer::~QWaylandDataOffer() -{ - wl_data_offer_destroy(m_data_offer); -} - -bool QWaylandDataOffer::hasFormat_sys(const QString &mimeType) const -{ - return m_offered_mime_types.contains(mimeType); -} - -QStringList QWaylandDataOffer::formats_sys() const -{ - return m_offered_mime_types; -} - -QVariant QWaylandDataOffer::retrieveData_sys(const QString &mimeType, QVariant::Type type) const -{ - Q_UNUSED(type); - if (m_offered_mime_types.isEmpty()) - return QVariant(); - - int pipefd[2]; - if (pipe(pipefd) == -1) { - qWarning("QWaylandMimeData: pipe() failed"); - return QVariant(); - } - - QByteArray mimeTypeBa = mimeType.toLatin1(); - wl_data_offer_receive(m_data_offer,mimeTypeBa.constData(),pipefd[1]); - - m_display->forceRoundTrip(); - close(pipefd[1]); - - QByteArray content; - char buf[256]; - int n; - while ((n = QT_READ(pipefd[0], &buf, sizeof buf)) > 0) { - content.append(buf, n); - } - - close(pipefd[0]); - return content; -} - -struct wl_data_offer *QWaylandDataOffer::handle() const -{ - return m_data_offer; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylanddataoffer.h b/src/plugins/platforms/wayland_common/qwaylanddataoffer.h deleted file mode 100644 index abc7c690a..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddataoffer.h +++ /dev/null @@ -1,90 +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 QWAYLANDDATAOFFER_H -#define QWAYLANDDATAOFFER_H - -#include <QString> -#include <QByteArray> -#include <QMimeData> - -#include <QtGui/private/qdnd_p.h> -#include <QtGui/QClipboard> - -#include <stdint.h> - -struct wl_callback; -struct wl_callback_listener; -struct wl_data_offer; -struct wl_data_offer_listener; - -QT_BEGIN_NAMESPACE - -class QWaylandDisplay; - -class QWaylandDataOffer : public QInternalMimeData -{ -public: - QWaylandDataOffer(QWaylandDisplay *display, struct wl_data_offer *offer); - ~QWaylandDataOffer(); - - bool hasFormat_sys(const QString &mimeType) const; - QStringList formats_sys() const; - QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const; - - struct wl_data_offer *handle() const; -private: - - struct wl_data_offer *m_data_offer; - QWaylandDisplay *m_display; - QStringList m_offered_mime_types; - wl_callback *m_receiveSyncCallback; - - static void offer(void *data, struct wl_data_offer *wl_data_offer, const char *type); - static const struct wl_data_offer_listener data_offer_listener; - - static void offer_sync_callback(void *data, struct wl_callback *wl_callback, uint32_t time); - static const struct wl_callback_listener offer_sync_callback_listener; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/wayland_common/qwaylanddatasource.cpp b/src/plugins/platforms/wayland_common/qwaylanddatasource.cpp deleted file mode 100644 index 7bf8b0c96..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddatasource.cpp +++ /dev/null @@ -1,121 +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 "qwaylanddatasource.h" -#include "qwaylanddataoffer.h" -#include "qwaylandinputdevice.h" -#include "qwaylandmimehelper.h" - -#include <QtCore/QFile> - -#include <QtCore/QDebug> - -#include <unistd.h> - -QT_BEGIN_NAMESPACE - -void QWaylandDataSource::data_source_target(void *data, - struct wl_data_source *wl_data_source, - const char *mime_type) -{ - Q_UNUSED(data); - Q_UNUSED(wl_data_source); - Q_UNUSED(mime_type); -} - -void QWaylandDataSource::data_source_send(void *data, - struct wl_data_source *wl_data_source, - const char *mime_type, - int32_t fd) -{ - Q_UNUSED(wl_data_source); - QWaylandDataSource *self = static_cast<QWaylandDataSource *>(data); - QString mimeType = QString::fromLatin1(mime_type); - QByteArray content = QWaylandMimeHelper::getByteArray(self->m_mime_data, mimeType); - if (!content.isEmpty()) { - QFile f; - if (f.open(fd, QIODevice::WriteOnly)) - f.write(content); - } - close(fd); -} - -void QWaylandDataSource::data_source_cancelled(void *data, - struct wl_data_source *wl_data_source) -{ - Q_UNUSED(data); - Q_UNUSED(wl_data_source); -} - -const struct wl_data_source_listener QWaylandDataSource::data_source_listener = { - data_source_target, - data_source_send, - data_source_cancelled -}; - -QWaylandDataSource::QWaylandDataSource(QWaylandDataDeviceManager *dndSelectionHandler, QMimeData *mimeData) - : m_mime_data(mimeData) -{ - m_data_source = wl_data_device_manager_create_data_source(dndSelectionHandler->handle()); - wl_data_source_add_listener(m_data_source,&data_source_listener,this); - QStringList formats = mimeData->formats(); - for (int i = 0; i < formats.size(); i++) { - const char *offer = qPrintable(formats.at(i)); - wl_data_source_offer(m_data_source,offer); - } -} - -QWaylandDataSource::~QWaylandDataSource() -{ - wl_data_source_destroy(m_data_source); -} - -QMimeData * QWaylandDataSource::mimeData() const -{ - return m_mime_data; -} - -struct wl_data_source *QWaylandDataSource::handle() const -{ - return m_data_source; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylanddatasource.h b/src/plugins/platforms/wayland_common/qwaylanddatasource.h deleted file mode 100644 index 8fdf06368..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddatasource.h +++ /dev/null @@ -1,79 +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 QWAYLANDDATASOURCE_H -#define QWAYLANDDATASOURCE_H - -#include "qwaylanddatadevicemanager.h" - -#include <wayland-client-protocol.h> - -QT_BEGIN_NAMESPACE - -class QWaylandDataSource -{ -public: - QWaylandDataSource(QWaylandDataDeviceManager *dndSelectionHandler, QMimeData *mimeData); - ~QWaylandDataSource(); - - QMimeData *mimeData() const; - - struct wl_data_source *handle() const; -private: - struct wl_data_source *m_data_source; - QWaylandDisplay *m_display; - QMimeData *m_mime_data; - - static void data_source_target(void *data, - struct wl_data_source *data_source, - const char *mime_type); - static void data_source_send(void *data, - struct wl_data_source *data_source, - const char *mime_type, - int32_t fd); - static void data_source_cancelled(void *data, - struct wl_data_source *data_source); - static const struct wl_data_source_listener data_source_listener; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDDATASOURCE_H diff --git a/src/plugins/platforms/wayland_common/qwaylanddecoration.cpp b/src/plugins/platforms/wayland_common/qwaylanddecoration.cpp deleted file mode 100644 index a4b978330..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddecoration.cpp +++ /dev/null @@ -1,458 +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 "qwaylanddecoration.h" - -#include "qwaylandwindow.h" -#include "qwaylandshellsurface.h" -#include "qwaylandinputdevice.h" -#include "qwaylandscreen.h" - -#include <QtGui/QGuiApplication> -#include <QtGui/QImage> -#include <QtGui/QCursor> -#include <QtGui/QPainter> -#include <QtGui/QPalette> -#include <QtGui/QLinearGradient> - -QT_BEGIN_NAMESPACE - -#define BUTTON_SPACING 5 - -#ifndef QT_NO_IMAGEFORMAT_XPM -# define BUTTON_WIDTH 10 - -static const char * const qt_close_xpm[] = { -"10 10 2 1", -"# c #000000", -". c None", -"..........", -".##....##.", -"..##..##..", -"...####...", -"....##....", -"...####...", -"..##..##..", -".##....##.", -"..........", -".........."}; - -static const char * const qt_maximize_xpm[]={ -"10 10 2 1", -"# c #000000", -". c None", -"#########.", -"#########.", -"#.......#.", -"#.......#.", -"#.......#.", -"#.......#.", -"#.......#.", -"#.......#.", -"#########.", -".........."}; - -static const char * const qt_minimize_xpm[] = { -"10 10 2 1", -"# c #000000", -". c None", -"..........", -"..........", -"..........", -"..........", -"..........", -"..........", -"..........", -".#######..", -".#######..", -".........."}; - -static const char * const qt_normalizeup_xpm[] = { -"10 10 2 1", -"# c #000000", -". c None", -"...######.", -"...######.", -"...#....#.", -".######.#.", -".######.#.", -".#....###.", -".#....#...", -".#....#...", -".######...", -".........."}; -#else -# define BUTTON_WIDTH 22 -#endif - -QWaylandDecoration::QWaylandDecoration(QWaylandWindow *window) - : m_window(window->window()) - , m_wayland_window(window) - , m_isDirty(true) - , m_decorationContentImage(0) - , m_margins(3,30,3,3) - , m_mouseButtons(Qt::NoButton) -{ - m_wayland_window->setDecoration(this); - - QPalette palette; - m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText); - m_backgroundColor = palette.color(QPalette::Active, QPalette::Highlight); - - QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter); - option.setWrapMode(QTextOption::NoWrap); - m_windowTitle.setTextOption(option); -} - -QWaylandDecoration::~QWaylandDecoration() -{ - m_wayland_window->setDecoration(0); -} - -const QImage &QWaylandDecoration::contentImage() -{ - if (m_isDirty) { - //Update the decoration backingstore - - m_decorationContentImage = QImage(window()->frameGeometry().size(), QImage::Format_ARGB32_Premultiplied); - m_decorationContentImage.fill(Qt::transparent); - this->paint(&m_decorationContentImage); - - m_isDirty = false; - } - - return m_decorationContentImage; -} - -void QWaylandDecoration::update() -{ - m_isDirty = true; -} - -void QWaylandDecoration::paint(QPaintDevice *device) -{ - QRect surfaceRect(QPoint(), window()->frameGeometry().size()); - QRect clips[] = - { - QRect(0, 0, surfaceRect.width(), margins().top()), - QRect(0, surfaceRect.height() - margins().bottom(), surfaceRect.width(), margins().bottom()), - QRect(0, margins().top(), margins().left(), surfaceRect.height() - margins().top() - margins().bottom()), - QRect(surfaceRect.width() - margins().right(), margins().top(), margins().left(), surfaceRect.height() - margins().top() - margins().bottom()) - }; - - QRect top = clips[0]; - - QPainter p(device); - p.setRenderHint(QPainter::Antialiasing); - - // Title bar - QPoint gradCenter(top.center()+ QPoint(30, 60)); - QLinearGradient grad(top.topLeft(), top.bottomLeft()); - QColor base(backgroundColor()); - grad.setColorAt(0, base.lighter(100)); - grad.setColorAt(1, base.darker(180)); - QPainterPath roundedRect; - roundedRect.addRoundedRect(surfaceRect, 6, 6); - for (int i = 0; i < 4; ++i) { - p.save(); - p.setClipRect(clips[i]); - p.fillPath(roundedRect, grad); - p.restore(); - } - - // Window icon - QIcon icon = m_wayland_window->windowIcon(); - if (!icon.isNull()) { - QPixmap pixmap = icon.pixmap(QSize(128, 128)); - QPixmap scaled = pixmap.scaled(22, 22, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - - QRectF iconRect(0, 0, 22, 22); - p.drawPixmap(iconRect.adjusted(margins().left() + BUTTON_SPACING, 4, - margins().left() + BUTTON_SPACING, 4), - scaled, iconRect); - } - - // Window title - QString windowTitleText = window()->title(); - if (!windowTitleText.isEmpty()) { - if (m_windowTitle.text() != windowTitleText) { - m_windowTitle.setText(windowTitleText); - m_windowTitle.prepare(); - } - - QRect titleBar = top; - titleBar.setLeft(m_margins.left() + BUTTON_SPACING + - (icon.isNull() ? 0 : 22 + BUTTON_SPACING)); - titleBar.setRight(minimizeButtonRect().left() - BUTTON_SPACING); - - p.save(); - p.setClipRect(titleBar); - p.setPen(m_foregroundColor); - QSizeF size = m_windowTitle.size(); - int dx = (top.width() - size.width()) /2; - int dy = (top.height()- size.height()) /2; - QFont font = p.font(); - font.setBold(true); - p.setFont(font); - QPoint windowTitlePoint(top.topLeft().x() + dx, - top.topLeft().y() + dy); - p.drawStaticText(windowTitlePoint,m_windowTitle); - p.restore(); - } - -#ifndef QT_NO_IMAGEFORMAT_XPM - p.save(); - - // Close button - QPixmap closePixmap(qt_close_xpm); - p.drawPixmap(closeButtonRect(), closePixmap, closePixmap.rect()); - - // Maximize button - QPixmap maximizePixmap(m_wayland_window->isMaximized() - ? qt_normalizeup_xpm : qt_maximize_xpm); - p.drawPixmap(maximizeButtonRect(), maximizePixmap, maximizePixmap.rect()); - - // Minimize button - QPixmap minimizePixmap(qt_minimize_xpm); - p.drawPixmap(minimizeButtonRect(), minimizePixmap, minimizePixmap.rect()); - - p.restore(); -#else - // We don't need antialiasing from now on - p.setRenderHint(QPainter::Antialiasing, false); - - QRectF rect; - - // Default pen - QPen pen(m_foregroundColor); - p.setPen(pen); - - // Close button - p.save(); - rect = closeButtonRect(); - p.drawRect(rect); - qreal crossSize = rect.height() / 2; - QPointF crossCenter(rect.center()); - QRectF crossRect(crossCenter.x() - crossSize / 2, crossCenter.y() - crossSize / 2, crossSize, crossSize); - pen.setWidth(2); - p.setPen(pen); - p.drawLine(crossRect.topLeft(), crossRect.bottomRight()); - p.drawLine(crossRect.bottomLeft(), crossRect.topRight()); - p.restore(); - - // Maximize button - p.save(); - p.drawRect(maximizeButtonRect()); - rect = maximizeButtonRect().adjusted(5, 5, -5, -5); - if (m_wayland_window->isMaximized()) { - QRectF rect1 = rect.adjusted(rect.width() / 3, 0, 0, -rect.height() / 3); - QRectF rect2 = rect.adjusted(0, rect.height() / 4, -rect.width() / 4, 0); - p.drawRect(rect1); - p.drawRect(rect2); - } else { - p.setPen(m_foregroundColor); - p.drawRect(rect); - p.drawLine(rect.left(), rect.top() + 1, rect.right(), rect.top() + 1); - } - p.restore(); - - // Minimize button - p.save(); - p.drawRect(minimizeButtonRect()); - rect = minimizeButtonRect().adjusted(5, 5, -5, -5); - pen.setWidth(2); - p.setPen(pen); - p.drawLine(rect.bottomLeft(), rect.bottomRight()); - p.restore(); -#endif -} - -bool QWaylandDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) - -{ - Q_UNUSED(global); - - // Figure out what area mouse is in - if (closeButtonRect().contains(local) && isLeftClicked(b)) { - QWindowSystemInterface::handleCloseEvent(m_window); - } else if (maximizeButtonRect().contains(local) && isLeftClicked(b)) { - m_window->setWindowState(m_wayland_window->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); - } else if (minimizeButtonRect().contains(local) && isLeftClicked(b)) { - m_window->setWindowState(Qt::WindowMinimized); - } else if (local.y() <= m_margins.top()) { - processMouseTop(inputDevice,local,b,mods); - } else if (local.y() > m_window->height() - m_margins.bottom() + m_margins.top()) { - processMouseBottom(inputDevice,local,b,mods); - } else if (local.x() <= m_margins.left()) { - processMouseLeft(inputDevice,local,b,mods); - } else if (local.x() > m_window->width() - m_margins.right() + m_margins.left()) { - processMouseRight(inputDevice,local,b,mods); - } else { - m_wayland_window->restoreMouseCursor(inputDevice); - return false; - } - - m_mouseButtons = b; - return true; -} - -bool QWaylandDecoration::inMouseButtonPressedState() const -{ - return m_mouseButtons & Qt::NoButton; -} - -void QWaylandDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons) -{ - if (isLeftClicked(buttons)) { - m_wayland_window->shellSurface()->resize(inputDevice, resize); - inputDevice->removeMouseButtonFromState(Qt::LeftButton); - } -} - -void QWaylandDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons) -{ - if (isLeftClicked(buttons)) { - m_wayland_window->shellSurface()->move(inputDevice); - inputDevice->removeMouseButtonFromState(Qt::LeftButton); - } -} - -void QWaylandDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) -{ - Q_UNUSED(mods); - if (local.y() <= m_margins.bottom()) { - if (local.x() <= margins().left()) { - //top left bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_LEFT,b); - } else if (local.x() > m_window->width() - margins().right()) { - //top right bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b); - } else { - //top reszie bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SplitVCursor); - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b); - } - } else { - m_wayland_window->restoreMouseCursor(inputDevice); - startMove(inputDevice,b); - } - -} - -void QWaylandDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) -{ - Q_UNUSED(mods); - if (local.x() <= margins().left()) { - //bottom left bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); - startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT,b); - } else if (local.x() > m_window->width() - margins().right()) { - //bottom right bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); - startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,b); - } else { - //bottom bit - m_wayland_window->setMouseCursor(inputDevice, Qt::SplitVCursor); - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_BOTTOM,b); - } -} - -void QWaylandDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) -{ - Q_UNUSED(local); - Q_UNUSED(mods); - m_wayland_window->setMouseCursor(inputDevice, Qt::SplitHCursor); - startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_LEFT,b); -} - -void QWaylandDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods) -{ - Q_UNUSED(local); - Q_UNUSED(mods); - m_wayland_window->setMouseCursor(inputDevice, Qt::SplitHCursor); - startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT,b); -} - -bool QWaylandDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState) -{ - if ((!m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton)) - return true; - return false; -} - -bool QWaylandDecoration::isLeftReleased(Qt::MouseButtons newMouseButtonState) -{ - if ((m_mouseButtons & Qt::LeftButton) && !(newMouseButtonState & Qt::LeftButton)) - return true; - return false; -} - -QRectF QWaylandDecoration::closeButtonRect() const -{ - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH - BUTTON_SPACING * 2, - (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); -} - -QRectF QWaylandDecoration::maximizeButtonRect() const -{ - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 2 - BUTTON_SPACING * 3, - (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); -} - -QRectF QWaylandDecoration::minimizeButtonRect() const -{ - return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 3 - BUTTON_SPACING * 4, - (m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH); -} - -void QWaylandDecoration::setForegroundColor(const QColor &c) -{ - m_foregroundColor = c; -} - -void QWaylandDecoration::setBackgroundColor(const QColor &c) -{ - m_backgroundColor = c; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylanddecoration.h b/src/plugins/platforms/wayland_common/qwaylanddecoration.h deleted file mode 100644 index 5efeab226..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddecoration.h +++ /dev/null @@ -1,154 +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 QWAYLANDDECORATION_H -#define QWAYLANDDECORATION_H - -#include <QtCore/QMargins> -#include <QtCore/QPointF> -#include <QtGui/QGuiApplication> -#include <QtGui/QCursor> -#include <QtGui/QColor> -#include <QtGui/QStaticText> -#include <QtGui/QImage> - -#include <wayland-client.h> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -class QWindow; -class QPaintDevice; -class QPainter; -class QEvent; -class QWaylandScreen; -class QWaylandWindow; -class QWaylandInputDevice; - -class QWaylandDecoration -{ -public: - QWaylandDecoration(QWaylandWindow *window); - virtual ~QWaylandDecoration(); - - void update(); - bool isDirty() const; - - bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods); - bool inMouseButtonPressedState() const; - - void startResize(QWaylandInputDevice *inputDevice,enum wl_shell_surface_resize resize, Qt::MouseButtons buttons); - void startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons); - QMargins margins() const; - QWindow *window() const; - QWaylandWindow *waylandWindow() const; - const QImage &contentImage(); - - void setForegroundColor(const QColor &c); - inline QColor foregroundColor() const; - - void setBackgroundColor(const QColor &c); - inline QColor backgroundColor() const; - -protected: - void paint(QPaintDevice *device); - -private: - void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); - void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); - void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); - void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); - - bool isLeftClicked(Qt::MouseButtons newMouseButtonState); - bool isLeftReleased(Qt::MouseButtons newMouseButtonState); - - QRectF closeButtonRect() const; - QRectF maximizeButtonRect() const; - QRectF minimizeButtonRect() const; - - QWindow *m_window; - QWaylandWindow *m_wayland_window; - - bool m_isDirty; - QImage m_decorationContentImage; - - QMargins m_margins; - Qt::MouseButtons m_mouseButtons; - - QColor m_foregroundColor; - QColor m_backgroundColor; - QStaticText m_windowTitle; -}; - -inline bool QWaylandDecoration::isDirty() const -{ - return m_isDirty; -} - -inline QMargins QWaylandDecoration::margins() const -{ - return m_margins; -} - -inline QWindow *QWaylandDecoration::window() const -{ - return m_window; -} - -inline QWaylandWindow *QWaylandDecoration::waylandWindow() const -{ - return m_wayland_window; -} - -inline QColor QWaylandDecoration::foregroundColor() const -{ - return m_foregroundColor; -} - -inline QColor QWaylandDecoration::backgroundColor() const -{ - return m_backgroundColor; -} - -QT_END_NAMESPACE - -#endif // QWAYLANDDECORATION_H diff --git a/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp b/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp deleted file mode 100644 index 6cc01d0ed..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp +++ /dev/null @@ -1,263 +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 "qwaylanddisplay.h" - -#include "qwaylandeventthread.h" -#include "qwaylandwindow.h" -#include "qwaylandscreen.h" -#include "qwaylandcursor.h" -#include "qwaylandinputdevice.h" -#include "qwaylandclipboard.h" -#include "qwaylanddatadevicemanager.h" - -#ifdef QT_WAYLAND_GL_SUPPORT -#include "qwaylandglintegration.h" -#endif - -#include "qwaylandwindowmanagerintegration.h" - -#include "qwaylandextendedoutput.h" -#include "qwaylandextendedsurface.h" -#include "qwaylandsubsurface.h" -#include "qwaylandtouch.h" -#include "qwaylandqtkey.h" - -#include <QtCore/QAbstractEventDispatcher> -#include <QtGui/private/qguiapplication_p.h> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -struct wl_surface *QWaylandDisplay::createSurface(void *handle) -{ - struct wl_surface *surface = mCompositor.create_surface(); - wl_surface_set_user_data(surface, handle); - return surface; -} - -#ifdef QT_WAYLAND_GL_SUPPORT -QWaylandGLIntegration * QWaylandDisplay::eglIntegration() -{ - return mEglIntegration; -} -#endif - -QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() -{ - return mWindowManagerIntegration; -} - -QWaylandInputDevice *QWaylandDisplay::lastKeyboardFocusInputDevice() const -{ - return mLastKeyboardFocusInputDevice; -} - -void QWaylandDisplay::setLastKeyboardFocusInputDevice(QWaylandInputDevice *device) -{ - mLastKeyboardFocusInputDevice = device; -} - -static QWaylandDisplay *display = 0; - -QWaylandDisplay::QWaylandDisplay() - : mLastKeyboardFocusInputDevice(0) - , mDndSelectionHandler(0) - , mWindowExtension(0) - , mSubSurfaceExtension(0) - , mOutputExtension(0) - , mTouchExtension(0) - , mQtKeyExtension(0) -{ - display = this; - qRegisterMetaType<uint32_t>("uint32_t"); - - mEventThreadObject = new QWaylandEventThread(0); - mEventThread = new QThread(this); - mEventThreadObject->moveToThread(mEventThread); - mEventThread->start(); - - mEventThreadObject->displayConnect(); - mDisplay = mEventThreadObject->display(); //blocks until display is available - - //Create a new even queue for the QtGui thread - mEventQueue = wl_display_create_queue(mDisplay); - - struct ::wl_registry *registry = wl_display_get_registry(mDisplay); - wl_proxy_set_queue((struct wl_proxy *)registry, mEventQueue); - - init(registry); - - QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; - connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(flushRequests())); - connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests())); - -#ifdef QT_WAYLAND_GL_SUPPORT - mEglIntegration = QWaylandGLIntegration::createGLIntegration(this); -#endif - - mWindowManagerIntegration = new QWaylandWindowManagerIntegration(this); - - blockingReadEvents(); - -#ifdef QT_WAYLAND_GL_SUPPORT - mEglIntegration->initialize(); - - flushRequests(); - while (mEglIntegration->waitingForEvents()) - blockingReadEvents(); -#endif - - waitForScreens(); -} - -QWaylandDisplay::~QWaylandDisplay(void) -{ -#ifdef QT_WAYLAND_GL_SUPPORT - delete mEglIntegration; -#endif - mEventThread->quit(); - mEventThread->wait(); - delete mEventThreadObject; -} - -void QWaylandDisplay::flushRequests() -{ - if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) == -1 && errno == EPIPE) - QCoreApplication::quit(); - wl_display_flush(mDisplay); -} - -void QWaylandDisplay::blockingReadEvents() -{ - if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1 && errno == EPIPE) - QCoreApplication::quit(); -} - -QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const -{ - for (int i = 0; i < mScreens.size(); ++i) { - QWaylandScreen *screen = static_cast<QWaylandScreen *>(mScreens.at(i)); - if (screen->output() == output) - return screen; - } - return 0; -} - -void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data) -{ - Listener l = { listener, data }; - mRegistryListeners.append(l); -} - -void QWaylandDisplay::waitForScreens() -{ - flushRequests(); - - while (true) { - bool screensReady = !mScreens.isEmpty(); - - for (int ii = 0; screensReady && ii < mScreens.count(); ++ii) { - if (mScreens.at(ii)->geometry() == QRect(0, 0, 0, 0)) - screensReady = false; - } - - if (!screensReady) - blockingReadEvents(); - else - return; - } -} - -void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uint32_t version) -{ - Q_UNUSED(version); - - struct ::wl_registry *registry = object(); - - if (interface == "wl_output") { - mScreens.append(new QWaylandScreen(this, id)); - } else if (interface == "wl_compositor") { - mCompositor.init(registry, id); - } else if (interface == "wl_shm") { - mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1)); - } else if (interface == "wl_shell"){ - mShell = new QtWayland::wl_shell(registry, id); - } else if (interface == "wl_seat") { - QWaylandInputDevice *inputDevice = new QWaylandInputDevice(this, id); - mInputDevices.append(inputDevice); - } else if (interface == "wl_data_device_manager") { - mDndSelectionHandler = new QWaylandDataDeviceManager(this, id); - } else if (interface == "qt_output_extension") { - mOutputExtension = new QtWayland::qt_output_extension(registry, id); - foreach (QPlatformScreen *screen, screens()) - static_cast<QWaylandScreen *>(screen)->createExtendedOutput(); - } else if (interface == "qt_surface_extension") { - mWindowExtension = new QtWayland::qt_surface_extension(registry, id); - } else if (interface == "qt_sub_surface_extension") { - mSubSurfaceExtension = new QtWayland::qt_sub_surface_extension(registry, id); - } else if (interface == "qt_touch_extension") { - mTouchExtension = new QWaylandTouchExtension(this, id); - } else if (interface == "qt_key_extension") { - mQtKeyExtension = new QWaylandQtKeyExtension(this, id); - } - - foreach (Listener l, mRegistryListeners) - (*l.listener)(l.data, registry, id, interface, version); -} - -uint32_t QWaylandDisplay::currentTimeMillisec() -{ - //### we throw away the time information - struct timeval tv; - int ret = gettimeofday(&tv, 0); - if (ret == 0) - return tv.tv_sec*1000 + tv.tv_usec/1000; - return 0; -} - -void QWaylandDisplay::forceRoundTrip() -{ - wl_display_roundtrip(mDisplay); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylanddisplay.h b/src/plugins/platforms/wayland_common/qwaylanddisplay.h deleted file mode 100644 index 6b2cc89d6..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddisplay.h +++ /dev/null @@ -1,186 +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 QWAYLANDDISPLAY_H -#define QWAYLANDDISPLAY_H - -#include <QtCore/QObject> -#include <QtCore/QRect> - -#include <QtCore/QWaitCondition> - -#include <wayland-client.h> -#include <qwayland-wayland.h> - -struct wl_cursor_image; - -QT_BEGIN_NAMESPACE - -class QAbstractEventDispatcher; -class QWaylandInputDevice; -class QSocketNotifier; -class QWaylandBuffer; -class QPlatformScreen; -class QWaylandScreen; -class QWaylandGLIntegration; -class QWaylandWindowManagerIntegration; -class QWaylandDataDeviceManager; -class QWaylandTouchExtension; -class QWaylandQtKeyExtension; -class QWaylandWindow; -class QWaylandEventThread; - -namespace QtWayland { - class qt_output_extension; - class qt_shell; - class qt_sub_surface_extension; - class qt_surface_extension; -} - -typedef void (*RegistryListener)(void *data, - struct wl_registry *registry, - uint32_t id, - const QString &interface, - uint32_t version); - -class QWaylandDisplay : public QObject, public QtWayland::wl_registry { - Q_OBJECT - -public: - QWaylandDisplay(void); - ~QWaylandDisplay(void); - - QList<QPlatformScreen *> screens() const { return mScreens; } - - QWaylandScreen *screenForOutput(struct wl_output *output) const; - - struct wl_surface *createSurface(void *handle); - -#ifdef QT_WAYLAND_GL_SUPPORT - QWaylandGLIntegration *eglIntegration(); -#endif - - QWaylandWindowManagerIntegration *windowManagerIntegration(); - - void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); - - struct wl_display *wl_display() const { return mDisplay; } - struct wl_event_queue *wl_event_queue() const { return mEventQueue; } - struct ::wl_registry *wl_registry() { return object(); } - - const struct wl_compositor *wl_compositor() const { return mCompositor.object(); } - QtWayland::wl_compositor *compositor() { return &mCompositor; } - - QtWayland::wl_shell *shell() { return mShell; } - - QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; } - - QWaylandInputDevice *lastKeyboardFocusInputDevice() const; - void setLastKeyboardFocusInputDevice(QWaylandInputDevice *device); - - QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler; } - - QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension; } - QtWayland::qt_sub_surface_extension *subSurfaceExtension() const { return mSubSurfaceExtension; } - QtWayland::qt_output_extension *outputExtension() const { return mOutputExtension; } - QWaylandTouchExtension *touchExtension() const { return mTouchExtension; } - - /* wl_registry_add_listener does not add but rather sets a listener, so this function is used - * to enable many listeners at once. */ - void addRegistryListener(RegistryListener listener, void *data); - - struct wl_shm *shm() const { return mShm; } - - static uint32_t currentTimeMillisec(); - - void forceRoundTrip(); - -public slots: - void blockingReadEvents(); - void flushRequests(); - -private: - void waitForScreens(); - - struct Listener { - RegistryListener listener; - void *data; - }; - - struct wl_display *mDisplay; - struct wl_event_queue *mEventQueue; - QtWayland::wl_compositor mCompositor; - struct wl_shm *mShm; - QThread *mEventThread; - QWaylandEventThread *mEventThreadObject; - QtWayland::wl_shell *mShell; - QList<QPlatformScreen *> mScreens; - QList<QWaylandInputDevice *> mInputDevices; - QList<Listener> mRegistryListeners; - QWaylandInputDevice *mLastKeyboardFocusInputDevice; - QWaylandDataDeviceManager *mDndSelectionHandler; - QtWayland::qt_surface_extension *mWindowExtension; - QtWayland::qt_sub_surface_extension *mSubSurfaceExtension; - QtWayland::qt_output_extension *mOutputExtension; - QWaylandTouchExtension *mTouchExtension; - QWaylandQtKeyExtension *mQtKeyExtension; - QWaylandWindowManagerIntegration *mWindowManagerIntegration; - - QSocketNotifier *mReadNotifier; - int mFd; - int mWritableNotificationFd; - bool mScreensInitialized; - - void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE; - -#ifdef QT_WAYLAND_GL_SUPPORT - QWaylandGLIntegration *mEglIntegration; -#endif - - static void shellHandleConfigure(void *data, struct wl_shell *shell, - uint32_t time, uint32_t edges, - struct wl_surface *surface, - int32_t width, int32_t height); -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDDISPLAY_H diff --git a/src/plugins/platforms/wayland_common/qwaylanddnd.cpp b/src/plugins/platforms/wayland_common/qwaylanddnd.cpp deleted file mode 100644 index 0dc80e636..000000000 --- a/src/plugins/platforms/wayland_common/qwaylanddnd.cpp +++ /dev/null @@ -1,97 +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 "qwaylanddnd.h" - -#include "qwaylanddatadevicemanager.h" - -QT_BEGIN_NAMESPACE - -QWaylandDrag::QWaylandDrag(QWaylandDisplay *display) - : m_display(display) -{ - -} - -QWaylandDrag::~QWaylandDrag() -{ - -} - -QMimeData * QWaylandDrag::platformDropData() -{ - return m_display->dndSelectionHandler()->dragMime(); -} - -Qt::DropAction QWaylandDrag::drag(QDrag *m_drag) -{ - Q_UNUSED(m_drag); -// m_display->dndSelectionHandler()->createAndSetDrag(drag); - return Qt::IgnoreAction; -} - -void QWaylandDrag::move(const QMouseEvent *me) -{ - Q_UNUSED(me); - qFatal("This function should not be called"); -} - -bool QWaylandDrag::canDrop() const -{ - return false; -} - -void QWaylandDrag::drop(const QMouseEvent *me) -{ - Q_UNUSED(me); -} - -void QWaylandDrag::cancel() -{ - m_display->dndSelectionHandler()->cancelDrag(); -} - -Qt::DropAction QWaylandDrag::executedDropAction() const -{ - return Qt::CopyAction; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandeventthread.cpp b/src/plugins/platforms/wayland_common/qwaylandeventthread.cpp deleted file mode 100644 index ca968a2d0..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandeventthread.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "qwaylandeventthread.h" -#include <QtCore/QSocketNotifier> -#include <QCoreApplication> - -#include <unistd.h> -#include <fcntl.h> -#include <stdio.h> -#include <errno.h> - -QT_BEGIN_NAMESPACE - -QWaylandEventThread::QWaylandEventThread(QObject *parent) - : QObject(parent) - , m_display(0) - , m_fileDescriptor(-1) - , m_readNotifier(0) - , m_displayLock(new QMutex) -{ -} - -QWaylandEventThread::~QWaylandEventThread() -{ - delete m_displayLock; - wl_display_disconnect(m_display); -} - -void QWaylandEventThread::displayConnect() -{ - m_displayLock->lock(); - QMetaObject::invokeMethod(this, "waylandDisplayConnect", Qt::QueuedConnection); -} - -void QWaylandEventThread::readWaylandEvents() -{ - if (wl_display_dispatch(m_display) == -1 && errno == EPIPE) - QCoreApplication::quit(); - emit newEventsRead(); -} - -void QWaylandEventThread::waylandDisplayConnect() -{ - m_display = wl_display_connect(NULL); - if (m_display == NULL) { - qErrnoWarning(errno, "Failed to create display"); - qFatal("No wayland connection available."); - } - m_displayLock->unlock(); - - m_fileDescriptor = wl_display_get_fd(m_display); - - m_readNotifier = new QSocketNotifier(m_fileDescriptor, QSocketNotifier::Read, this); - connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(readWaylandEvents())); -} - -wl_display *QWaylandEventThread::display() const -{ - QMutexLocker displayLock(m_displayLock); - return m_display; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandeventthread.h b/src/plugins/platforms/wayland_common/qwaylandeventthread.h deleted file mode 100644 index f4aec744c..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandeventthread.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef QWAYLANDEVENTTHREAD_H -#define QWAYLANDEVENTTHREAD_H - -#include <QObject> -#include <QMutex> -#include <wayland-client.h> - -QT_BEGIN_NAMESPACE - -class QSocketNotifier; - -class QWaylandEventThread : public QObject -{ - Q_OBJECT -public: - explicit QWaylandEventThread(QObject *parent = 0); - ~QWaylandEventThread(); - - void displayConnect(); - - wl_display *display() const; - -private slots: - void readWaylandEvents(); - - void waylandDisplayConnect(); - -signals: - void newEventsRead(); - -private: - - struct wl_display *m_display; - int m_fileDescriptor; - - QSocketNotifier *m_readNotifier; - - QMutex *m_displayLock; - -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDEVENTTHREAD_H diff --git a/src/plugins/platforms/wayland_common/qwaylandextendedoutput.cpp b/src/plugins/platforms/wayland_common/qwaylandextendedoutput.cpp deleted file mode 100644 index d7c684be9..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandextendedoutput.cpp +++ /dev/null @@ -1,100 +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 "qwaylandextendedoutput.h" - -#include "qwaylandscreen.h" - -#include <qpa/qwindowsysteminterface.h> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -QWaylandExtendedOutput::QWaylandExtendedOutput(QWaylandScreen *screen, ::qt_extended_output *extended_output) - : QtWayland::qt_extended_output(extended_output) - , m_screen(screen) - , m_orientation(m_screen->orientation()) -{ -} - -Qt::ScreenOrientation QWaylandExtendedOutput::currentOrientation() const -{ - return m_orientation; -} - -void QWaylandExtendedOutput::setOrientationUpdateMask(Qt::ScreenOrientations orientations) -{ - int mask = 0; - if (orientations & Qt::PortraitOrientation) - mask |= QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION; - if (orientations & Qt::LandscapeOrientation) - mask |= QT_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION; - if (orientations & Qt::InvertedPortraitOrientation) - mask |= QT_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION; - if (orientations & Qt::InvertedLandscapeOrientation) - mask |= QT_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION; - set_orientation_update_mask(mask); -} - -void QWaylandExtendedOutput::extended_output_set_screen_rotation(int32_t rotation) -{ - switch (rotation) { - case QT_EXTENDED_OUTPUT_ROTATION_PORTRAITORIENTATION: - m_orientation = Qt::PortraitOrientation; - break; - case QT_EXTENDED_OUTPUT_ROTATION_LANDSCAPEORIENTATION: - m_orientation = Qt::LandscapeOrientation; - break; - case QT_EXTENDED_OUTPUT_ROTATION_INVERTEDPORTRAITORIENTATION: - m_orientation = Qt::InvertedPortraitOrientation; - break; - case QT_EXTENDED_OUTPUT_ROTATION_INVERTEDLANDSCAPEORIENTATION: - m_orientation = Qt::InvertedLandscapeOrientation; - break; - default: - m_orientation = Qt::PortraitOrientation; - break; - } - QWindowSystemInterface::handleScreenOrientationChange(m_screen->screen(), m_orientation); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandextendedoutput.h b/src/plugins/platforms/wayland_common/qwaylandextendedoutput.h deleted file mode 100644 index dd9ce6a85..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandextendedoutput.h +++ /dev/null @@ -1,69 +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 QWAYLANDEXTENDEDOUTPUT_H -#define QWAYLANDEXTENDEDOUTPUT_H - -#include "qwaylanddisplay.h" -#include "qwayland-output-extension.h" - -QT_BEGIN_NAMESPACE - -class QWaylandExtendedOutput; - -class QWaylandExtendedOutput : public QtWayland::qt_extended_output -{ -public: - QWaylandExtendedOutput(QWaylandScreen *screen, struct ::qt_extended_output *extended_output); - - Qt::ScreenOrientation currentOrientation() const; - void setOrientationUpdateMask(Qt::ScreenOrientations mask); - -private: - void extended_output_set_screen_rotation(int32_t rotation) Q_DECL_OVERRIDE; - - QWaylandScreen *m_screen; - Qt::ScreenOrientation m_orientation; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDEXTENDEDOUTPUT_H diff --git a/src/plugins/platforms/wayland_common/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland_common/qwaylandextendedsurface.cpp deleted file mode 100644 index 58eb0a833..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandextendedsurface.cpp +++ /dev/null @@ -1,151 +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 "qwaylandextendedsurface.h" - -#include "qwaylandwindow.h" - -#include "wayland-client.h" - -#include "qwaylanddisplay.h" - -#include "qwaylandnativeinterface.h" - -#include <QtGui/QGuiApplication> -#include <qpa/qplatformnativeinterface.h> -#include <qpa/qwindowsysteminterface.h> - -QT_BEGIN_NAMESPACE - -QWaylandExtendedSurface::QWaylandExtendedSurface(QWaylandWindow *window, struct ::qt_extended_surface *extended_surface) - : QtWayland::qt_extended_surface(extended_surface) - , m_window(window) -{ -} - -QWaylandExtendedSurface::~QWaylandExtendedSurface() -{ - qt_extended_surface_destroy(object()); -} - -void QWaylandExtendedSurface::updateGenericProperty(const QString &name, const QVariant &value) -{ - QByteArray byteValue; - QDataStream ds(&byteValue, QIODevice::WriteOnly); - ds << value; - - update_generic_property(name, byteValue); - - m_properties.insert(name, value); - QWaylandNativeInterface *nativeInterface = static_cast<QWaylandNativeInterface *>( - QGuiApplication::platformNativeInterface()); - nativeInterface->emitWindowPropertyChanged(m_window, name); -} - -static int32_t waylandRotationFromScreenOrientation(Qt::ScreenOrientation orientation) -{ - switch (orientation) { - case Qt::PortraitOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION; - case Qt::InvertedPortraitOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION; - case Qt::LandscapeOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION; - case Qt::InvertedLandscapeOrientation: return QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION; - default: return QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION; - } -} - -void QWaylandExtendedSurface::setContentOrientation(Qt::ScreenOrientation orientation) -{ - set_content_orientation(waylandRotationFromScreenOrientation(orientation)); -} - -QVariantMap QWaylandExtendedSurface::properties() const -{ - return m_properties; -} - -QVariant QWaylandExtendedSurface::property(const QString &name) -{ - return m_properties.value(name); -} - -QVariant QWaylandExtendedSurface::property(const QString &name, const QVariant &defaultValue) -{ - return m_properties.value(name,defaultValue); -} - -void QWaylandExtendedSurface::extended_surface_onscreen_visibility(int32_t visibility) -{ - m_window->window()->setVisibility(static_cast<QWindow::Visibility>(visibility)); -} - -void QWaylandExtendedSurface::extended_surface_set_generic_property(const QString &name, wl_array *value) -{ - QByteArray data = QByteArray::fromRawData(static_cast<char *>(value->data), value->size); - - QVariant variantValue; - QDataStream ds(data); - ds >> variantValue; - - m_properties.insert(name, variantValue); - - QWaylandNativeInterface *nativeInterface = static_cast<QWaylandNativeInterface *>( - QGuiApplication::platformNativeInterface()); - nativeInterface->emitWindowPropertyChanged(m_window, name); -} - -void QWaylandExtendedSurface::extended_surface_close() -{ - QWindowSystemInterface::handleCloseEvent(m_window->window()); -} - -Qt::WindowFlags QWaylandExtendedSurface::setWindowFlags(Qt::WindowFlags flags) -{ - uint wlFlags = 0; - - if (flags & Qt::WindowStaysOnTopHint) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP; - if (flags & Qt::WindowOverridesSystemGestures) wlFlags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES; - - set_window_flags(wlFlags); - - return flags & (Qt::WindowStaysOnTopHint | Qt::WindowOverridesSystemGestures); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandextendedsurface.h b/src/plugins/platforms/wayland_common/qwaylandextendedsurface.h deleted file mode 100644 index 4bef5e073..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandextendedsurface.h +++ /dev/null @@ -1,83 +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 QWAYLANDEXTENDEDSURFACE_H -#define QWAYLANDEXTENDEDSURFACE_H - -#include <QtCore/QString> -#include <QtCore/QVariant> - -#include <wayland-client.h> -#include <qwayland-surface-extension.h> - -QT_BEGIN_NAMESPACE - -class QWaylandDisplay; -class QWaylandWindow; - -class QWaylandExtendedSurface : public QtWayland::qt_extended_surface -{ -public: - QWaylandExtendedSurface(QWaylandWindow *window, struct ::qt_extended_surface *extended_surface); - ~QWaylandExtendedSurface(); - - void setContentOrientation(Qt::ScreenOrientation orientation); - - void updateGenericProperty(const QString &name, const QVariant &value); - - QVariantMap properties() const; - QVariant property(const QString &name); - QVariant property(const QString &name, const QVariant &defaultValue); - - Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); - -private: - void extended_surface_onscreen_visibility(int32_t visibility) Q_DECL_OVERRIDE; - void extended_surface_set_generic_property(const QString &name, wl_array *value) Q_DECL_OVERRIDE; - void extended_surface_close() Q_DECL_OVERRIDE; - - QWaylandWindow *m_window; - QVariantMap m_properties; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDEXTENDEDSURFACE_H diff --git a/src/plugins/platforms/wayland_common/qwaylandglintegration.cpp b/src/plugins/platforms/wayland_common/qwaylandglintegration.cpp deleted file mode 100644 index bafb99443..000000000 --- a/src/plugins/platforms/wayland_common/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/plugins/platforms/wayland_common/qwaylandglintegration.h b/src/plugins/platforms/wayland_common/qwaylandglintegration.h deleted file mode 100644 index 4055790b3..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandglintegration.h +++ /dev/null @@ -1,75 +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 <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - -class QWaylandWindow; -class QWaylandDisplay; -class QWindow; - -class QPlatformOpenGLContext; -class QSurfaceFormat; - -class 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/plugins/platforms/wayland_common/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland_common/qwaylandinputdevice.cpp deleted file mode 100644 index aab939f6d..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandinputdevice.cpp +++ /dev/null @@ -1,739 +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 "qwaylandinputdevice.h" - -#include "qwaylandintegration.h" -#include "qwaylandwindow.h" -#include "qwaylandbuffer.h" -#include "qwaylanddatadevicemanager.h" -#include "qwaylandtouch.h" -#include "qwaylandscreen.h" -#include "qwaylandcursor.h" - -#include <QtGui/private/qpixmap_raster_p.h> -#include <qpa/qplatformwindow.h> -#include <QDebug> - -#include <unistd.h> -#include <fcntl.h> -#include <sys/mman.h> - -#include <wayland-cursor.h> - -#include <QtGui/QGuiApplication> - -#ifndef QT_NO_WAYLAND_XKB -#include <xkbcommon/xkbcommon.h> -#include <X11/keysym.h> -#endif - -QT_BEGIN_NAMESPACE - -QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id) - : QtWayland::wl_seat(display->wl_registry(), id) - , mQDisplay(display) - , mDisplay(display->wl_display()) - , mFocusCallback(0) - , mCaps(0) - , mTransferDevice(0) - , mPointerFocus(0) - , mKeyboardFocus(0) - , mTouchFocus(0) - , mButtons(0) - , mCursorSerial(0) - , mTouchDevice(0) - #ifndef QT_NO_WAYLAND_XKB - , mXkbContext(0) - , mXkbMap(0) - , mXkbState(0) - #endif -{ -#ifndef QT_NO_WAYLAND_XKB - xkb_rule_names names; - names.rules = strdup("evdev"); - names.model = strdup("pc105"); - names.layout = strdup("us"); - names.variant = strdup(""); - names.options = strdup(""); - - mXkbContext = xkb_context_new(xkb_context_flags(0)); - if (mXkbContext) { - mXkbMap = xkb_map_new_from_names(mXkbContext, &names, xkb_map_compile_flags(0)); - if (mXkbMap) { - mXkbState = xkb_state_new(mXkbMap); - } - } - - if (!mXkbContext || !mXkbMap || !mXkbState) - qWarning() << "xkb_map_new_from_names failed, no key input"; -#endif - - if (mQDisplay->dndSelectionHandler()) { - mTransferDevice = mQDisplay->dndSelectionHandler()->getDataDevice(this); - } -} - -QWaylandInputDevice::~QWaylandInputDevice() -{ -#ifndef QT_NO_WAYLAND_XKB - if (mXkbState) - xkb_state_unref(mXkbState); - if (mXkbMap) - xkb_map_unref(mXkbMap); - if (mXkbContext) - xkb_context_unref(mXkbContext); -#endif -} - -void QWaylandInputDevice::seat_capabilities(uint32_t caps) -{ - mCaps = caps; - - if (caps & WL_SEAT_CAPABILITY_KEYBOARD) - QtWayland::wl_keyboard::init(get_keyboard()); - - if (caps & WL_SEAT_CAPABILITY_POINTER) { - QtWayland::wl_pointer::init(get_pointer()); - pointerSurface = mQDisplay->createSurface(this); - } - - if (caps & WL_SEAT_CAPABILITY_TOUCH) { - QtWayland::wl_touch::init(get_touch()); - - if (!mTouchDevice) { - mTouchDevice = new QTouchDevice; - mTouchDevice->setType(QTouchDevice::TouchScreen); - mTouchDevice->setCapabilities(QTouchDevice::Position); - QWindowSystemInterface::registerTouchDevice(mTouchDevice); - } - } -} - -void QWaylandInputDevice::handleWindowDestroyed(QWaylandWindow *window) -{ - if (window == mPointerFocus) - mPointerFocus = 0; - if (window == mKeyboardFocus) - mKeyboardFocus = 0; -} - -void QWaylandInputDevice::setTransferDevice(struct wl_data_device *device) -{ - mTransferDevice = device; -} - -struct wl_data_device *QWaylandInputDevice::transferDevice() const -{ - Q_ASSERT(mTransferDevice); - return mTransferDevice; -} - -void QWaylandInputDevice::removeMouseButtonFromState(Qt::MouseButton button) -{ - mButtons = mButtons & !button; -} - -void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *screen) -{ - struct wl_cursor_image *image = screen->waylandCursor()->cursorImage(newShape); - if (!image) { - return; - } - - struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); - setCursor(buffer, image); -} - -void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image) -{ - if (mCaps & WL_SEAT_CAPABILITY_POINTER) { - mCursorSerial = mEnterSerial; - /* Hide cursor */ - if (!buffer) - { - set_cursor(mEnterSerial, NULL, 0, 0); - return; - } - - set_cursor(mEnterSerial, pointerSurface, - image->hotspot_x, image->hotspot_y); - wl_surface_attach(pointerSurface, buffer, 0, 0); - wl_surface_damage(pointerSurface, 0, 0, image->width, image->height); - wl_surface_commit(pointerSurface); - } -} - -void QWaylandInputDevice::pointer_enter(uint32_t serial, struct wl_surface *surface, - wl_fixed_t sx, wl_fixed_t sy) -{ - Q_UNUSED(sx); - Q_UNUSED(sy); - - if (!surface) - return; - - QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); - window->window()->setCursor(window->window()->cursor()); - - mPointerFocus = window; - - mTime = QWaylandDisplay::currentTimeMillisec(); - mSerial = serial; - mEnterSerial = serial; - - window->handleMouseEnter(this); - window->handleMouse(this, mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); -} - -void QWaylandInputDevice::pointer_leave(uint32_t time, struct wl_surface *surface) -{ - // The event may arrive after destroying the window, indicated by - // a null surface. - if (!surface) - return; - - QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); - window->handleMouseLeave(this); - mPointerFocus = 0; - mButtons = Qt::NoButton; - - mTime = time; -} - -void QWaylandInputDevice::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) -{ - Q_UNUSED(surface_x); - Q_UNUSED(surface_y); - - QWaylandWindow *window = mPointerFocus; - - if (window == NULL) { - // We destroyed the pointer focus surface, but the server - // didn't get the message yet. - return; - } - - QPointF pos(wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y)); - QPointF delta = pos - pos.toPoint(); - QPointF global = window->window()->mapToGlobal(pos.toPoint()); - global += delta; - - mSurfacePos = pos; - mGlobalPos = global; - mTime = time; - - window->handleMouse(this, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); -} - -void QWaylandInputDevice::pointer_button(uint32_t serial, uint32_t time, - uint32_t button, uint32_t state) -{ - Q_UNUSED(serial); - QWaylandWindow *window = mPointerFocus; - Qt::MouseButton qt_button; - - // translate from kernel (input.h) 'button' to corresponding Qt:MouseButton. - // The range of mouse values is 0x110 <= mouse_button < 0x120, the first Joystick button. - switch (button) { - case 0x110: qt_button = Qt::LeftButton; break; // kernel BTN_LEFT - case 0x111: qt_button = Qt::RightButton; break; - case 0x112: qt_button = Qt::MiddleButton; break; - case 0x113: qt_button = Qt::ExtraButton1; break; // AKA Qt::BackButton - case 0x114: qt_button = Qt::ExtraButton2; break; // AKA Qt::ForwardButton - case 0x115: qt_button = Qt::ExtraButton3; break; // AKA Qt::TaskButton - case 0x116: qt_button = Qt::ExtraButton4; break; - case 0x117: qt_button = Qt::ExtraButton5; break; - case 0x118: qt_button = Qt::ExtraButton6; break; - case 0x119: qt_button = Qt::ExtraButton7; break; - case 0x11a: qt_button = Qt::ExtraButton8; break; - case 0x11b: qt_button = Qt::ExtraButton9; break; - case 0x11c: qt_button = Qt::ExtraButton10; break; - case 0x11d: qt_button = Qt::ExtraButton11; break; - case 0x11e: qt_button = Qt::ExtraButton12; break; - case 0x11f: qt_button = Qt::ExtraButton13; break; - default: return; // invalid button number (as far as Qt is concerned) - } - - if (state) - mButtons |= qt_button; - else - mButtons &= ~qt_button; - - mTime = time; - mSerial = serial; - - if (window) - window->handleMouse(this, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); -} - -void QWaylandInputDevice::pointer_axis(uint32_t time, uint32_t axis, int32_t value) -{ - QWaylandWindow *window = mPointerFocus; - QPoint pixelDelta; - QPoint angleDelta; - - //normalize value and inverse axis - int valueDelta = wl_fixed_to_int(value) * -12; - - if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) { - pixelDelta = QPoint(); - angleDelta.setX(valueDelta); - } else { - pixelDelta = QPoint(); - angleDelta.setY(valueDelta); - } - - QWindowSystemInterface::handleWheelEvent(window->window(), - time, mSurfacePos, - mGlobalPos, pixelDelta, - angleDelta); -} - -#ifndef QT_NO_WAYLAND_XKB - -static Qt::KeyboardModifiers translateModifiers(xkb_state *state) -{ - Qt::KeyboardModifiers ret = Qt::NoModifier; - xkb_state_component cstate = xkb_state_component(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED); - - if (xkb_state_mod_name_is_active(state, "Shift", cstate)) - ret |= Qt::ShiftModifier; - if (xkb_state_mod_name_is_active(state, "Control", cstate)) - ret |= Qt::ControlModifier; - if (xkb_state_mod_name_is_active(state, "Alt", cstate)) - ret |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(state, "Mod1", cstate)) - ret |= Qt::AltModifier; - if (xkb_state_mod_name_is_active(state, "Mod4", cstate)) - ret |= Qt::MetaModifier; - - return ret; -} - -static const uint32_t KeyTbl[] = { - XK_Escape, Qt::Key_Escape, - XK_Tab, Qt::Key_Tab, - XK_ISO_Left_Tab, Qt::Key_Backtab, - XK_BackSpace, Qt::Key_Backspace, - XK_Return, Qt::Key_Return, - XK_Insert, Qt::Key_Insert, - XK_Delete, Qt::Key_Delete, - XK_Clear, Qt::Key_Delete, - XK_Pause, Qt::Key_Pause, - XK_Print, Qt::Key_Print, - - XK_Home, Qt::Key_Home, - XK_End, Qt::Key_End, - XK_Left, Qt::Key_Left, - XK_Up, Qt::Key_Up, - XK_Right, Qt::Key_Right, - XK_Down, Qt::Key_Down, - XK_Prior, Qt::Key_PageUp, - XK_Next, Qt::Key_PageDown, - - XK_Shift_L, Qt::Key_Shift, - XK_Shift_R, Qt::Key_Shift, - XK_Shift_Lock, Qt::Key_Shift, - XK_Control_L, Qt::Key_Control, - XK_Control_R, Qt::Key_Control, - XK_Meta_L, Qt::Key_Meta, - XK_Meta_R, Qt::Key_Meta, - XK_Alt_L, Qt::Key_Alt, - XK_Alt_R, Qt::Key_Alt, - XK_Caps_Lock, Qt::Key_CapsLock, - XK_Num_Lock, Qt::Key_NumLock, - XK_Scroll_Lock, Qt::Key_ScrollLock, - XK_Super_L, Qt::Key_Super_L, - XK_Super_R, Qt::Key_Super_R, - XK_Menu, Qt::Key_Menu, - XK_Hyper_L, Qt::Key_Hyper_L, - XK_Hyper_R, Qt::Key_Hyper_R, - XK_Help, Qt::Key_Help, - - XK_KP_Space, Qt::Key_Space, - XK_KP_Tab, Qt::Key_Tab, - XK_KP_Enter, Qt::Key_Enter, - XK_KP_Home, Qt::Key_Home, - XK_KP_Left, Qt::Key_Left, - XK_KP_Up, Qt::Key_Up, - XK_KP_Right, Qt::Key_Right, - XK_KP_Down, Qt::Key_Down, - XK_KP_Prior, Qt::Key_PageUp, - XK_KP_Next, Qt::Key_PageDown, - XK_KP_End, Qt::Key_End, - XK_KP_Begin, Qt::Key_Clear, - XK_KP_Insert, Qt::Key_Insert, - XK_KP_Delete, Qt::Key_Delete, - XK_KP_Equal, Qt::Key_Equal, - XK_KP_Multiply, Qt::Key_Asterisk, - XK_KP_Add, Qt::Key_Plus, - XK_KP_Separator, Qt::Key_Comma, - XK_KP_Subtract, Qt::Key_Minus, - XK_KP_Decimal, Qt::Key_Period, - XK_KP_Divide, Qt::Key_Slash, - - XK_ISO_Level3_Shift, Qt::Key_AltGr, - XK_Multi_key, Qt::Key_Multi_key, - XK_Codeinput, Qt::Key_Codeinput, - XK_SingleCandidate, Qt::Key_SingleCandidate, - XK_MultipleCandidate, Qt::Key_MultipleCandidate, - XK_PreviousCandidate, Qt::Key_PreviousCandidate, - - XK_Mode_switch, Qt::Key_Mode_switch, - XK_script_switch, Qt::Key_Mode_switch, - - 0, 0 -}; - -static int keysymToQtKey(xkb_keysym_t key) -{ - int code = 0; - int i = 0; - while (KeyTbl[i]) { - if (key == KeyTbl[i]) { - code = (int)KeyTbl[i+1]; - break; - } - i += 2; - } - - return code; -} - -static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, const QString &text) -{ - int code = 0; - - if (keysym >= XKB_KEY_F1 && keysym <= XKB_KEY_F35) { - code = Qt::Key_F1 + (int(keysym) - XKB_KEY_F1); - } else if (keysym >= XKB_KEY_KP_Space && keysym <= XKB_KEY_KP_9) { - if (keysym >= XKB_KEY_KP_0) { - // numeric keypad keys - code = Qt::Key_0 + ((int)keysym - XKB_KEY_KP_0); - } else { - code = keysymToQtKey(keysym); - } - modifiers |= Qt::KeypadModifier; - } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f - && text.unicode()->unicode() != 0x7f - && !(keysym >= XKB_KEY_dead_grave && keysym <= XKB_KEY_dead_currency)) { - code = text.unicode()->toUpper().unicode(); - } else { - // any other keys - code = keysymToQtKey(keysym); - } - - return code; -} - -#endif // QT_NO_WAYLAND_XKB - -void QWaylandInputDevice::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size) -{ -#ifndef QT_NO_WAYLAND_XKB - if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { - close(fd); - return; - } - - char *map_str = (char *)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); - if (map_str == MAP_FAILED) { - close(fd); - return; - } - - mXkbMap = xkb_map_new_from_string(mXkbContext, map_str, XKB_KEYMAP_FORMAT_TEXT_V1, (xkb_keymap_compile_flags)0); - munmap(map_str, size); - close(fd); - - mXkbState = xkb_state_new(mXkbMap); -#else - Q_UNUSED(format); - Q_UNUSED(fd); - Q_UNUSED(size); -#endif -} - -void QWaylandInputDevice::keyboard_enter(uint32_t time, struct wl_surface *surface, struct wl_array *keys) -{ - Q_UNUSED(time); - Q_UNUSED(keys); - - if (!surface) - return; - - - QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); - mKeyboardFocus = window; - - if (!mFocusCallback) { - mFocusCallback = wl_display_sync(mDisplay); - wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::callback, this); - } -} - -void QWaylandInputDevice::keyboard_leave(uint32_t time, struct wl_surface *surface) -{ - Q_UNUSED(time); - Q_UNUSED(surface); - - mKeyboardFocus = NULL; - - // Use a callback to set the focus because we may get a leave/enter pair, and - // the latter one would be lost in the QWindowSystemInterface queue, if - // we issue the handleWindowActivated() calls immediately. - if (!mFocusCallback) { - mFocusCallback = wl_display_sync(mDisplay); - wl_callback_add_listener(mFocusCallback, &QWaylandInputDevice::callback, this); - } -} - -const wl_callback_listener QWaylandInputDevice::callback = { - QWaylandInputDevice::focusCallback -}; - -void QWaylandInputDevice::focusCallback(void *data, struct wl_callback *callback, uint32_t time) -{ - Q_UNUSED(time); - Q_UNUSED(callback); - QWaylandInputDevice *self = static_cast<QWaylandInputDevice *>(data); - if (self->mFocusCallback) { - wl_callback_destroy(self->mFocusCallback); - self->mFocusCallback = 0; - } - - self->mQDisplay->setLastKeyboardFocusInputDevice(self->mKeyboardFocus ? self : 0); - QWindowSystemInterface::handleWindowActivated(self->mKeyboardFocus ? self->mKeyboardFocus->window() : 0); -} - -void QWaylandInputDevice::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) -{ - Q_UNUSED(serial); - QWaylandWindow *window = mKeyboardFocus; -#ifndef QT_NO_WAYLAND_XKB - if (!mXkbMap) - return; - - uint32_t code = key + 8; - bool isDown = state != 0; - const xkb_keysym_t *syms; - uint32_t numSyms = xkb_key_get_syms(mXkbState, code, &syms); - xkb_state_update_key(mXkbState, code, - isDown ? XKB_KEY_DOWN : XKB_KEY_UP); - - if (!window) { - // We destroyed the keyboard focus surface, but the server - // didn't get the message yet. - return; - } - - if (numSyms == 1) { - xkb_keysym_t sym = syms[0]; - Qt::KeyboardModifiers modifiers = translateModifiers(mXkbState); - QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; - - uint utf32 = xkb_keysym_to_utf32(sym); - QString text = QString::fromUcs4(&utf32, 1); - - int qtkey = keysymToQtKey(sym, modifiers, text); - - QWindowSystemInterface::handleExtendedKeyEvent(window->window(), - time, type, qtkey, - modifiers, - code, 0, 0, text); - } -#else - // Generic fallback for single hard keys: Assume 'key' is a Qt key code. - if (window) { - QWindowSystemInterface::handleExtendedKeyEvent(window->window(), - time, state ? QEvent::KeyPress : QEvent::KeyRelease, - key + 8, // qt-compositor substracts 8 for some reason - Qt::NoModifier, - key + 8, 0, 0); - } -#endif -} - -void QWaylandInputDevice::keyboard_modifiers(uint32_t serial, - uint32_t mods_depressed, - uint32_t mods_latched, - uint32_t mods_locked, - uint32_t group) -{ - Q_UNUSED(serial); -#ifndef QT_NO_WAYLAND_XKB - if (mXkbState) - xkb_state_update_mask(mXkbState, - mods_depressed, mods_latched, mods_locked, - 0, 0, group); -#else - Q_UNUSED(serial); - Q_UNUSED(mods_depressed); - Q_UNUSED(mods_latched); - Q_UNUSED(mods_locked); - Q_UNUSED(group); -#endif -} - -void QWaylandInputDevice::touch_down(uint32_t serial, - uint32_t time, - struct wl_surface *surface, - int32_t id, - wl_fixed_t x, - wl_fixed_t y) -{ - Q_UNUSED(serial); - Q_UNUSED(time); - mTouchFocus = QWaylandWindow::fromWlSurface(surface); - handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed); -} - -void QWaylandInputDevice::touch_up(uint32_t serial, uint32_t time, int32_t id) -{ - Q_UNUSED(serial); - Q_UNUSED(time); - mTouchFocus = 0; - handleTouchPoint(id, 0, 0, Qt::TouchPointReleased); -} - -void QWaylandInputDevice::touch_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) -{ - Q_UNUSED(time); - handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointMoved); -} - -void QWaylandInputDevice::touch_cancel() -{ - mPrevTouchPoints.clear(); - mTouchPoints.clear(); - - QWaylandTouchExtension *touchExt = mQDisplay->touchExtension(); - if (touchExt) - touchExt->touchCanceled(); - - QWindowSystemInterface::handleTouchCancelEvent(0, mTouchDevice); -} - -void QWaylandInputDevice::handleTouchPoint(int id, double x, double y, Qt::TouchPointState state) -{ - QWindowSystemInterface::TouchPoint tp; - - // Find out the coordinates for Released events. - bool coordsOk = false; - if (state == Qt::TouchPointReleased) - for (int i = 0; i < mPrevTouchPoints.count(); ++i) - if (mPrevTouchPoints.at(i).id == id) { - tp.area = mPrevTouchPoints.at(i).area; - coordsOk = true; - break; - } - - if (!coordsOk) { - // x and y are surface relative. - // We need a global (screen) position. - QWaylandWindow *win = mTouchFocus; - - //is it possible that mTouchFocus is null; - if (!win) - win = mPointerFocus; - if (!win) - win = mKeyboardFocus; - if (!win || !win->window()) - return; - - tp.area = QRectF(0, 0, 8, 8); - QMargins margins = win->frameMargins(); - tp.area.moveCenter(win->window()->mapToGlobal(QPoint(x+margins.left(), y+margins.top()))); - } - - tp.state = state; - tp.id = id; - tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1; - mTouchPoints.append(tp); -} - -void QWaylandInputDevice::touch_frame() -{ - // Copy all points, that are in the previous but not in the current list, as stationary. - for (int i = 0; i < mPrevTouchPoints.count(); ++i) { - const QWindowSystemInterface::TouchPoint &prevPoint(mPrevTouchPoints.at(i)); - if (prevPoint.state == Qt::TouchPointReleased) - continue; - bool found = false; - for (int j = 0; j < mTouchPoints.count(); ++j) - if (mTouchPoints.at(j).id == prevPoint.id) { - found = true; - break; - } - if (!found) { - QWindowSystemInterface::TouchPoint p = prevPoint; - p.state = Qt::TouchPointStationary; - mTouchPoints.append(p); - } - } - - if (mTouchPoints.isEmpty()) { - mPrevTouchPoints.clear(); - return; - } - - QWindow *window = mTouchFocus ? mTouchFocus->window() : 0; - - QWindowSystemInterface::handleTouchEvent(window, mTouchDevice, mTouchPoints); - - bool allReleased = true; - for (int i = 0; i < mTouchPoints.count(); ++i) - if (mTouchPoints.at(i).state != Qt::TouchPointReleased) { - allReleased = false; - break; - } - - mPrevTouchPoints = mTouchPoints; - mTouchPoints.clear(); - - if (allReleased) { - QWindowSystemInterface::handleTouchEvent(window, mTouchDevice, mTouchPoints); - mPrevTouchPoints.clear(); - } -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandinputdevice.h b/src/plugins/platforms/wayland_common/qwaylandinputdevice.h deleted file mode 100644 index c92026841..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandinputdevice.h +++ /dev/null @@ -1,183 +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 QWAYLANDINPUTDEVICE_H -#define QWAYLANDINPUTDEVICE_H - -#include "qwaylandwindow.h" - -#include <QSocketNotifier> -#include <QObject> -#include <qpa/qplatformintegration.h> -#include <qpa/qplatformscreen.h> -#include <qpa/qwindowsysteminterface.h> - -#include <wayland-client.h> - -#include "qwayland-wayland.h" - -#ifndef QT_NO_WAYLAND_XKB -struct xkb_context; -struct xkb_keymap; -struct xkb_state; -#endif - -QT_BEGIN_NAMESPACE - -class QWaylandWindow; -class QWaylandDisplay; - -class QWaylandInputDevice : public QtWayland::wl_pointer, public QtWayland::wl_keyboard, public QtWayland::wl_touch, public QtWayland::wl_seat -{ -public: - QWaylandInputDevice(QWaylandDisplay *display, uint32_t id); - ~QWaylandInputDevice(); - - uint32_t capabilities() const { return mCaps; } - - struct ::wl_seat *wl_seat() { return QtWayland::wl_seat::object(); } - - void setCursor(Qt::CursorShape cursor, QWaylandScreen *screen); - void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image); - void handleWindowDestroyed(QWaylandWindow *window); - - void setTransferDevice(struct wl_data_device *device); - struct wl_data_device *transferDevice() const; - - void removeMouseButtonFromState(Qt::MouseButton button); - - uint32_t serial() const; - uint32_t cursorSerial() const { return mCursorSerial; } - -private: - QWaylandDisplay *mQDisplay; - struct wl_display *mDisplay; - struct wl_callback *mFocusCallback; - - uint32_t mCaps; - - struct wl_surface *pointerSurface; - - struct wl_data_device *mTransferDevice; - QWaylandWindow *mPointerFocus; - QWaylandWindow *mKeyboardFocus; - QWaylandWindow *mTouchFocus; - - Qt::MouseButtons mButtons; - QPointF mSurfacePos; - QPointF mGlobalPos; - uint32_t mTime; - uint32_t mSerial; - uint32_t mEnterSerial; - uint32_t mCursorSerial; - - void seat_capabilities(uint32_t caps) Q_DECL_OVERRIDE; - - void pointer_enter(uint32_t serial, struct wl_surface *surface, - wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; - void pointer_leave(uint32_t time, struct wl_surface *surface); - void pointer_motion(uint32_t time, - wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE; - void pointer_button(uint32_t serial, uint32_t time, - uint32_t button, uint32_t state) Q_DECL_OVERRIDE; - void pointer_axis(uint32_t time, - uint32_t axis, - wl_fixed_t value) Q_DECL_OVERRIDE; - - void keyboard_keymap(uint32_t format, - int32_t fd, - uint32_t size) Q_DECL_OVERRIDE; - void keyboard_enter(uint32_t time, - struct wl_surface *surface, - struct wl_array *keys) Q_DECL_OVERRIDE; - void keyboard_leave(uint32_t time, - struct wl_surface *surface) Q_DECL_OVERRIDE; - void keyboard_key(uint32_t serial, uint32_t time, - uint32_t key, uint32_t state) Q_DECL_OVERRIDE; - void keyboard_modifiers(uint32_t serial, - uint32_t mods_depressed, - uint32_t mods_latched, - uint32_t mods_locked, - uint32_t group) Q_DECL_OVERRIDE; - - void touch_down(uint32_t serial, - uint32_t time, - struct wl_surface *surface, - int32_t id, - wl_fixed_t x, - wl_fixed_t y) Q_DECL_OVERRIDE; - void touch_up(uint32_t serial, - uint32_t time, - int32_t id) Q_DECL_OVERRIDE; - void touch_motion(uint32_t time, - int32_t id, - wl_fixed_t x, - wl_fixed_t y) Q_DECL_OVERRIDE; - void touch_frame() Q_DECL_OVERRIDE; - void touch_cancel() Q_DECL_OVERRIDE; - - void handleTouchPoint(int id, double x, double y, Qt::TouchPointState state); - - static const wl_callback_listener callback; - static void focusCallback(void *data, struct wl_callback *callback, uint32_t time); - - QList<QWindowSystemInterface::TouchPoint> mTouchPoints; - QList<QWindowSystemInterface::TouchPoint> mPrevTouchPoints; - QTouchDevice *mTouchDevice; - -#ifndef QT_NO_WAYLAND_XKB - xkb_context *mXkbContext; - xkb_keymap *mXkbMap; - xkb_state *mXkbState; -#endif - - friend class QWaylandTouchExtension; - friend class QWaylandQtKeyExtension; -}; - -inline uint32_t QWaylandInputDevice::serial() const -{ - return mSerial; -} - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/wayland_common/qwaylandintegration.cpp b/src/plugins/platforms/wayland_common/qwaylandintegration.cpp deleted file mode 100644 index b0d5b271f..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandintegration.cpp +++ /dev/null @@ -1,244 +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 config.tests 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 "qwaylandintegration.h" - -#include "qwaylanddisplay.h" -#include "qwaylandshmbackingstore.h" -#include "qwaylandshmwindow.h" -#include "qwaylandnativeinterface.h" -#include "qwaylandclipboard.h" -#include "qwaylanddnd.h" -#include "qwaylandwindowmanagerintegration.h" - -#include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h" -#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> -#include <QtPlatformSupport/private/qgenericunixthemes_p.h> - -#include <QtGui/private/qguiapplication_p.h> - -#include <qpa/qwindowsysteminterface.h> -#include <qpa/qplatformcursor.h> -#include <QtGui/QSurfaceFormat> -#include <QtGui/QOpenGLContext> - -#include <qpa/qplatforminputcontextfactory_p.h> -#include <qpa/qplatformaccessibility.h> -#include <qpa/qplatforminputcontext.h> - -#ifdef QT_WAYLAND_GL_SUPPORT -#include "qwaylandglintegration.h" -#endif - - -QT_BEGIN_NAMESPACE - -class GenericWaylandTheme: public QGenericUnixTheme -{ -public: - static QStringList themeNames() - { - QStringList result; - - if (QGuiApplication::desktopSettingsAware()) { - const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); - - // Ignore X11 desktop environments - if (!desktopEnvironment.isEmpty() && - desktopEnvironment != QByteArrayLiteral("UNKNOWN") && - desktopEnvironment != QByteArrayLiteral("KDE") && - desktopEnvironment != QByteArrayLiteral("GNOME") && - desktopEnvironment != QByteArrayLiteral("UNITY") && - desktopEnvironment != QByteArrayLiteral("MATE") && - desktopEnvironment != QByteArrayLiteral("XFCE") && - desktopEnvironment != QByteArrayLiteral("LXDE")) - result.push_back(desktopEnvironment.toLower()); - } - - if (result.isEmpty()) - result.push_back(QLatin1String(QGenericUnixTheme::name)); - - return result; - } -}; - -QWaylandIntegration::QWaylandIntegration() - : mFontDb(new QGenericUnixFontDatabase()) - , mEventDispatcher(createUnixEventDispatcher()) - , mNativeInterface(new QWaylandNativeInterface(this)) -#ifndef QT_NO_ACCESSIBILITY - , mAccessibility(new QPlatformAccessibility()) -#else - , mAccessibility(0) -#endif -{ - QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher); - mDisplay = new QWaylandDisplay(); - mClipboard = new QWaylandClipboard(mDisplay); - mDrag = new QWaylandDrag(mDisplay); - - foreach (QPlatformScreen *screen, mDisplay->screens()) - screenAdded(screen); - - mInputContext = QPlatformInputContextFactory::create(); -} - -QWaylandIntegration::~QWaylandIntegration() -{ - delete mDrag; - delete mClipboard; -#ifndef QT_NO_ACCESSIBILITY - delete mAccessibility; -#endif - delete mNativeInterface; - delete mDisplay; -} - -QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const -{ - return mNativeInterface; -} - -bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) const -{ - switch (cap) { - case ThreadedPixmaps: return true; - case OpenGL: -#ifdef QT_WAYLAND_GL_SUPPORT - return true; -#else - return false; -#endif - case ThreadedOpenGL: -#ifdef QT_WAYLAND_GL_SUPPORT - return mDisplay->eglIntegration()->supportsThreadedOpenGL(); -#else - return false; -#endif - case BufferQueueingOpenGL: - return true; - default: return QPlatformIntegration::hasCapability(cap); - } -} - -QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const -{ -#ifdef QT_WAYLAND_GL_SUPPORT - if (window->surfaceType() == QWindow::OpenGLSurface) - return mDisplay->eglIntegration()->createEglWindow(window); -#endif - return new QWaylandShmWindow(window); -} - -QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const -{ -#ifdef QT_WAYLAND_GL_SUPPORT - return mDisplay->eglIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); -#else - Q_UNUSED(context); - return 0; -#endif -} - -QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const -{ - return new QWaylandShmBackingStore(window); -} - -QAbstractEventDispatcher *QWaylandIntegration::guiThreadEventDispatcher() const -{ - return mEventDispatcher; -} - -QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const -{ - return mFontDb; -} - -QPlatformClipboard *QWaylandIntegration::clipboard() const -{ - return mClipboard; -} - -QPlatformDrag *QWaylandIntegration::drag() const -{ - return mDrag; -} - -QPlatformInputContext *QWaylandIntegration::inputContext() const -{ - return mInputContext; -} - -QVariant QWaylandIntegration::styleHint(StyleHint hint) const -{ - if (hint == ShowIsFullScreen && mDisplay->windowManagerIntegration()) - return mDisplay->windowManagerIntegration()->showIsFullScreen(); - - return QPlatformIntegration::styleHint(hint); -} - -QPlatformAccessibility *QWaylandIntegration::accessibility() const -{ - return mAccessibility; -} - -QPlatformServices *QWaylandIntegration::services() const -{ - return mDisplay->windowManagerIntegration(); -} - -QWaylandDisplay *QWaylandIntegration::display() const -{ - return mDisplay; -} - -QStringList QWaylandIntegration::themeNames() const -{ - return GenericWaylandTheme::themeNames(); -} - -QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) const -{ - return GenericWaylandTheme::createUnixTheme(name); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandintegration.h b/src/plugins/platforms/wayland_common/qwaylandintegration.h deleted file mode 100644 index fe9b113e3..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandintegration.h +++ /dev/null @@ -1,101 +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 QPLATFORMINTEGRATION_WAYLAND_H -#define QPLATFORMINTEGRATION_WAYLAND_H - -#include <qpa/qplatformintegration.h> - -QT_BEGIN_NAMESPACE - -class QWaylandBuffer; -class QWaylandDisplay; -class QAbstractEventDispatcher; - -class QWaylandIntegration : public QPlatformIntegration -{ -public: - QWaylandIntegration(); - ~QWaylandIntegration(); - - bool hasCapability(QPlatformIntegration::Capability cap) const; - QPlatformWindow *createPlatformWindow(QWindow *window) const; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; - - QAbstractEventDispatcher *guiThreadEventDispatcher() const; - - QPlatformFontDatabase *fontDatabase() const; - - QPlatformNativeInterface *nativeInterface() const; - - QPlatformClipboard *clipboard() const; - - QPlatformDrag *drag() const; - - QPlatformInputContext *inputContext() const; - - QVariant styleHint(StyleHint hint) const; - - QPlatformAccessibility *accessibility() const; - - QPlatformServices *services() const; - - QWaylandDisplay *display() const; - - QStringList themeNames() const; - - QPlatformTheme *createPlatformTheme(const QString &name) const; - -private: - QPlatformFontDatabase *mFontDb; - QAbstractEventDispatcher *mEventDispatcher; - QPlatformClipboard *mClipboard; - QPlatformDrag *mDrag; - QWaylandDisplay *mDisplay; - QPlatformNativeInterface *mNativeInterface; - QPlatformInputContext *mInputContext; - QPlatformAccessibility *mAccessibility; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/wayland_common/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland_common/qwaylandnativeinterface.cpp deleted file mode 100644 index 354e8dbaa..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandnativeinterface.cpp +++ /dev/null @@ -1,134 +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 "qwaylandnativeinterface.h" -#include "qwaylanddisplay.h" -#include "qwaylandwindow.h" -#include "qwaylandextendedsurface.h" -#include "qwaylandintegration.h" -#include "qwaylanddisplay.h" -#include "qwaylandwindowmanagerintegration.h" -#include <QtGui/private/qguiapplication_p.h> -#include <QtGui/QScreen> - -QT_BEGIN_NAMESPACE - -QWaylandNativeInterface::QWaylandNativeInterface(QWaylandIntegration *integration) - : m_integration(integration) -{ -} - -void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString) -{ - QByteArray lowerCaseResource = resourceString.toLower(); - - if (lowerCaseResource == "display") - return m_integration->display()->wl_display(); - if (lowerCaseResource == "compositor") - return const_cast<wl_compositor *>(m_integration->display()->wl_compositor()); - - return 0; -} - -void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) -{ - QByteArray lowerCaseResource = resourceString.toLower(); - - if (lowerCaseResource == "display") - return m_integration->display()->wl_display(); - if (lowerCaseResource == "compositor") - return const_cast<wl_compositor *>(m_integration->display()->wl_compositor()); - if (lowerCaseResource == "surface") { - return ((QWaylandWindow *) window->handle())->object(); - } - - return NULL; -} - -void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourceString, QScreen *screen) -{ - QByteArray lowerCaseResource = resourceString.toLower(); - - if (lowerCaseResource == "output") - return ((QWaylandScreen *) screen->handle())->output(); - - return NULL; -} - -QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const -{ - QWaylandWindow *waylandWindow = static_cast<QWaylandWindow *>(window); - if (QWaylandExtendedSurface *extendedWindow = waylandWindow->extendedWindow()) - return extendedWindow->properties(); - return QVariantMap(); -} - - -QVariant QWaylandNativeInterface::windowProperty(QPlatformWindow *window, const QString &name) const -{ - QWaylandWindow *waylandWindow = static_cast<QWaylandWindow *>(window); - if (QWaylandExtendedSurface *extendedWindow = waylandWindow->extendedWindow()) - return extendedWindow->property(name); - return QVariant(); -} - -QVariant QWaylandNativeInterface::windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const -{ - QWaylandWindow *waylandWindow = static_cast<QWaylandWindow *>(window); - if (QWaylandExtendedSurface *extendedWindow = waylandWindow->extendedWindow()) { - return extendedWindow->property(name,defaultValue); - } - return defaultValue; -} - -void QWaylandNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) -{ - QWaylandWindow *wlWindow = static_cast<QWaylandWindow*>(window); - if (QWaylandExtendedSurface *extendedWindow = wlWindow->extendedWindow()) - extendedWindow->updateGenericProperty(name,value); -} - -void QWaylandNativeInterface::emitWindowPropertyChanged(QPlatformWindow *window, const QString &name) -{ - emit windowPropertyChanged(window,name); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandnativeinterface.h b/src/plugins/platforms/wayland_common/qwaylandnativeinterface.h deleted file mode 100644 index 5c1fe601d..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandnativeinterface.h +++ /dev/null @@ -1,79 +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 QWAYLANDNATIVEINTERFACE_H -#define QWAYLANDNATIVEINTERFACE_H - -#include "qwaylandscreen.h" -#include <QVariantMap> -#include <qpa/qplatformnativeinterface.h> - -QT_BEGIN_NAMESPACE - -class QWaylandIntegration; - -class QWaylandNativeInterface : public QPlatformNativeInterface -{ -public: - QWaylandNativeInterface(QWaylandIntegration *integration); - void *nativeResourceForIntegration(const QByteArray &resource); - void *nativeResourceForWindow(const QByteArray &resourceString, - QWindow *window); - void *nativeResourceForScreen(const QByteArray &resourceString, - QScreen *screen); - - QVariantMap windowProperties(QPlatformWindow *window) const; - QVariant windowProperty(QPlatformWindow *window, const QString &name) const; - QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const; - void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); - - void emitWindowPropertyChanged(QPlatformWindow *window, const QString &name); -private: - static QWaylandScreen *qPlatformScreenForWindow(QWindow *window); - -private: - QWaylandIntegration *m_integration; - QHash<QPlatformWindow*, QVariantMap> m_windowProperties; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDNATIVEINTERFACE_H diff --git a/src/plugins/platforms/wayland_common/qwaylandqtkey.cpp b/src/plugins/platforms/wayland_common/qwaylandqtkey.cpp deleted file mode 100644 index e723078cd..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandqtkey.cpp +++ /dev/null @@ -1,84 +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 "qwaylandqtkey.h" -#include "qwaylandinputdevice.h" - -QT_BEGIN_NAMESPACE - -QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id) - : QtWayland::qt_key_extension(display->wl_registry(), id) - , m_display(display) -{ -} - -void QWaylandQtKeyExtension::key_extension_qtkey(uint32_t time, - uint32_t type, - uint32_t key, - uint32_t modifiers, - uint32_t nativeScanCode, - uint32_t nativeVirtualKey, - uint32_t nativeModifiers, - const QString &text, - uint32_t autorep, - uint32_t count) -{ - QList<QWaylandInputDevice *> inputDevices = m_display->inputDevices(); - if (inputDevices.isEmpty()) { - qWarning("qt_key_extension: handle_qtkey: No input device"); - return; - } - - QWaylandInputDevice *dev = inputDevices.first(); - QWaylandWindow *win = dev->mKeyboardFocus; - - if (!win || !win->window()) { - qWarning("qt_key_extension: handle_qtkey: No keyboard focus"); - return; - } - - QWindow *window = win->window(); - QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::Type(type), key, Qt::KeyboardModifiers(modifiers), - nativeScanCode, nativeVirtualKey, nativeModifiers, text, - autorep, count); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandqtkey.h b/src/plugins/platforms/wayland_common/qwaylandqtkey.h deleted file mode 100644 index 17b758cf9..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandqtkey.h +++ /dev/null @@ -1,74 +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 QWAYLANDQTKEY_H -#define QWAYLANDQTKEY_H - -#include "qwaylanddisplay.h" -#include <qpa/qwindowsysteminterface.h> - -#include "qwayland-qtkey-extension.h" - -QT_BEGIN_NAMESPACE - -class QWaylandQtKeyExtension : public QtWayland::qt_key_extension -{ -public: - QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id); - -private: - QWaylandDisplay *m_display; - - void key_extension_qtkey(uint32_t time, - uint32_t type, - uint32_t key, - uint32_t modifiers, - uint32_t nativeScanCode, - uint32_t nativeVirtualKey, - uint32_t nativeModifiers, - const QString &text, - uint32_t autorep, - uint32_t count) Q_DECL_OVERRIDE; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDQTKEY_H diff --git a/src/plugins/platforms/wayland_common/qwaylandscreen.cpp b/src/plugins/platforms/wayland_common/qwaylandscreen.cpp deleted file mode 100644 index 5956c2fd3..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandscreen.cpp +++ /dev/null @@ -1,175 +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 "qwaylandscreen.h" - -#include "qwaylanddisplay.h" -#include "qwaylandcursor.h" -#include "qwaylandextendedoutput.h" - -#include <qpa/qwindowsysteminterface.h> - -QT_BEGIN_NAMESPACE - -QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id) - : QtWayland::wl_output(waylandDisplay->wl_registry(), id) - , mWaylandDisplay(waylandDisplay) - , mExtendedOutput(0) - , mDepth(32) - , mRefreshRate(60000) - , mFormat(QImage::Format_ARGB32_Premultiplied) - , mOutputName(QStringLiteral("Screen%1").arg(id)) - , mWaylandCursor(new QWaylandCursor(this)) -{ - // handle case of output extension global being sent after outputs - createExtendedOutput(); -} - -QWaylandScreen::~QWaylandScreen() -{ - delete mWaylandCursor; -} - -QWaylandDisplay * QWaylandScreen::display() const -{ - return mWaylandDisplay; -} - -QRect QWaylandScreen::geometry() const -{ - return mGeometry; -} - -int QWaylandScreen::depth() const -{ - return mDepth; -} - -QImage::Format QWaylandScreen::format() const -{ - return mFormat; -} - -void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) -{ - if (mExtendedOutput) - mExtendedOutput->setOrientationUpdateMask(mask); -} - -Qt::ScreenOrientation QWaylandScreen::orientation() const -{ - if (mExtendedOutput) - return mExtendedOutput->currentOrientation(); - return QPlatformScreen::orientation(); -} - -qreal QWaylandScreen::refreshRate() const -{ - return mRefreshRate / 1000.f; -} - -QPlatformCursor *QWaylandScreen::cursor() const -{ - return mWaylandCursor; -} - -QWaylandExtendedOutput *QWaylandScreen::extendedOutput() const -{ - return mExtendedOutput; -} - -void QWaylandScreen::createExtendedOutput() -{ - QtWayland::qt_output_extension *extension = mWaylandDisplay->outputExtension(); - if (!mExtendedOutput && extension) - mExtendedOutput = new QWaylandExtendedOutput(this, extension->get_extended_output(output())); -} - -QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) -{ - QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(window); - return static_cast<QWaylandScreen *>(platformScreen); -} - -void QWaylandScreen::output_mode(uint32_t flags, int width, int height, int refresh) -{ - if (!(flags & WL_OUTPUT_MODE_CURRENT)) - return; - - QSize size(width, height); - - if (size != mGeometry.size()) { - mGeometry.setSize(size); - QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry); - QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), mGeometry); - } - - if (refresh != mRefreshRate) { - mRefreshRate = refresh; - QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate()); - } -} - -void QWaylandScreen::output_geometry(int32_t x, int32_t y, - int32_t width, int32_t height, - int subpixel, - const QString &make, - const QString &model, - int32_t transform) -{ - Q_UNUSED(subpixel); - Q_UNUSED(make); - Q_UNUSED(transform); - - if (!model.isEmpty()) - mOutputName = model; - - QRect geom(x, y, width, height); - - if (mGeometry == geom) - return; - - mGeometry = geom; - QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry); - QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), mGeometry); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandscreen.h b/src/plugins/platforms/wayland_common/qwaylandscreen.h deleted file mode 100644 index 91848ad05..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandscreen.h +++ /dev/null @@ -1,107 +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 QWAYLANDSCREEN_H -#define QWAYLANDSCREEN_H - -#include <qpa/qplatformscreen.h> - -#include <qwayland-wayland.h> - -QT_BEGIN_NAMESPACE - -class QWaylandDisplay; -class QWaylandCursor; -class QWaylandExtendedOutput; - -class QWaylandScreen : public QPlatformScreen, QtWayland::wl_output -{ -public: - QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id); - ~QWaylandScreen(); - - QWaylandDisplay *display() const; - - QRect geometry() const; - int depth() const; - QImage::Format format() const; - - void setOrientationUpdateMask(Qt::ScreenOrientations mask); - - Qt::ScreenOrientation orientation() const; - qreal refreshRate() const; - - QString name() const { return mOutputName; } - - QPlatformCursor *cursor() const; - QWaylandCursor *waylandCursor() const { return mWaylandCursor; }; - - ::wl_output *output() { return object(); } - - QWaylandExtendedOutput *extendedOutput() const; - void createExtendedOutput(); - - static QWaylandScreen *waylandScreenFromWindow(QWindow *window); - -private: - void output_mode(uint32_t flags, int width, int height, int refresh) Q_DECL_OVERRIDE; - void output_geometry(int32_t x, int32_t y, - int32_t width, int32_t height, - int subpixel, - const QString &make, - const QString &model, - int32_t transform) Q_DECL_OVERRIDE; - - QWaylandDisplay *mWaylandDisplay; - QWaylandExtendedOutput *mExtendedOutput; - QRect mGeometry; - int mDepth; - int mRefreshRate; - QImage::Format mFormat; - QSize mPhysicalSize; - QString mOutputName; - - QWaylandCursor *mWaylandCursor; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDSCREEN_H diff --git a/src/plugins/platforms/wayland_common/qwaylandshellsurface.cpp b/src/plugins/platforms/wayland_common/qwaylandshellsurface.cpp deleted file mode 100644 index 6e638e6b1..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandshellsurface.cpp +++ /dev/null @@ -1,176 +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 config.tests 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 "qwaylandshellsurface.h" - -#include "qwaylanddisplay.h" -#include "qwaylandwindow.h" -#include "qwaylandinputdevice.h" -#include "qwaylanddecoration.h" -#include "qwaylandscreen.h" - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -QWaylandShellSurface::QWaylandShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window) - : QtWayland::wl_shell_surface(shell_surface) - , m_window(window) - , m_maximized(false) - , m_fullscreen(false) -{ -} - -QWaylandShellSurface::~QWaylandShellSurface() -{ - wl_shell_surface_destroy(object()); -} - -void QWaylandShellSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) -{ - resize(inputDevice->wl_seat(), - inputDevice->serial(), - edges); -} - -void QWaylandShellSurface::move(QWaylandInputDevice *inputDevice) -{ - move(inputDevice->wl_seat(), - inputDevice->serial()); -} - -void QWaylandShellSurface::setMaximized() -{ - m_maximized = true; - m_size = m_window->window()->geometry().size(); - set_maximized(0); -} - -void QWaylandShellSurface::setFullscreen() -{ - m_fullscreen = true; - m_size = m_window->window()->geometry().size(); - set_fullscreen(0, 0, 0); -} - -void QWaylandShellSurface::setNormal() -{ - if (m_fullscreen || m_maximized) { - m_fullscreen = m_maximized = false; - setTopLevel(); - QMargins m = m_window->frameMargins(); - m_window->configure(0, m_size.width() + m.left() + m.right(), m_size.height() + m.top() + m.bottom()); - } -} - -void QWaylandShellSurface::setMinimized() -{ - // TODO: There's no wl_shell_surface API for this -} - -void QWaylandShellSurface::setTopLevel() -{ - set_toplevel(); -} - -void QWaylandShellSurface::updateTransientParent(QWindow *parent) -{ - QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle()); - if (!parent_wayland_window) - return; - - // set_transient expects a position relative to the parent - QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - QWindow *parentWin = m_window->window()->transientParent(); - transientPos -= parentWin->geometry().topLeft(); - if (parent_wayland_window->decoration()) { - transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); - transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); - } - - uint32_t flags = 0; - Qt::WindowFlags wf = m_window->window()->flags(); - if (wf.testFlag(Qt::ToolTip) - || wf.testFlag(Qt::WindowTransparentForInput)) - flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE; - - set_transient(parent_wayland_window->object(), - transientPos.x(), - transientPos.y(), - flags); -} - -void QWaylandShellSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) -{ - QWaylandWindow *parent_wayland_window = parent; - if (!parent_wayland_window) - return; - - // set_popup expects a position relative to the parent - QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - transientPos -= parent_wayland_window->geometry().topLeft(); - if (parent_wayland_window->decoration()) { - transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); - transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); - } - - set_popup(device->wl_seat(), serial, parent_wayland_window->object(), - transientPos.x(), transientPos.y(), 0); -} - -void QWaylandShellSurface::shell_surface_ping(uint32_t serial) -{ - pong(serial); -} - -void QWaylandShellSurface::shell_surface_configure(uint32_t edges, - int32_t width, - int32_t height) -{ - m_window->configure(edges, width, height); -} - -void QWaylandShellSurface::shell_surface_popup_done() -{ - QCoreApplication::postEvent(m_window->window(), new QCloseEvent()); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandshellsurface.h b/src/plugins/platforms/wayland_common/qwaylandshellsurface.h deleted file mode 100644 index 172a0f965..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandshellsurface.h +++ /dev/null @@ -1,95 +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 config.tests 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 QWAYLANDSHELLSURFACE_H -#define QWAYLANDSHELLSURFACE_H - -#include <QtCore/QSize> - -#include <wayland-client.h> - -#include "qwayland-wayland.h" - -QT_BEGIN_NAMESPACE - -class QWaylandWindow; -class QWaylandInputDevice; -class QWindow; - -class QWaylandShellSurface : public QtWayland::wl_shell_surface -{ -public: - QWaylandShellSurface(struct ::wl_shell_surface *shell_surface, QWaylandWindow *window); - ~QWaylandShellSurface(); - - using QtWayland::wl_shell_surface::resize; - void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges); - - using QtWayland::wl_shell_surface::move; - void move(QWaylandInputDevice *inputDevice); - -private: - void setMaximized(); - void setFullscreen(); - void setNormal(); - void setMinimized(); - - void setTopLevel(); - void updateTransientParent(QWindow *parent); - void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); - - QWaylandWindow *m_window; - bool m_maximized; - bool m_fullscreen; - QSize m_size; - - void shell_surface_ping(uint32_t serial) Q_DECL_OVERRIDE; - void shell_surface_configure(uint32_t edges, - int32_t width, - int32_t height) Q_DECL_OVERRIDE; - void shell_surface_popup_done() Q_DECL_OVERRIDE; - - friend class QWaylandWindow; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDSHELLSURFACE_H diff --git a/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.cpp deleted file mode 100644 index 00a4b13a2..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.cpp +++ /dev/null @@ -1,322 +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 "qwaylandshmbackingstore.h" - -#include <QtCore/qdebug.h> - -#include "qwaylanddisplay.h" -#include "qwaylandshmwindow.h" -#include "qwaylandscreen.h" -#include "qwaylanddecoration.h" - -#include <QtGui/QPainter> - -#include <wayland-client.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/mman.h> - -QT_BEGIN_NAMESPACE - -QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format) - : mMarginsImage(0) -{ - int stride = size.width() * 4; - int alloc = stride * size.height(); - char filename[] = "/tmp/wayland-shm-XXXXXX"; - int fd = mkstemp(filename); - if (fd < 0) { - qWarning("mkstemp %s failed: %s", filename, strerror(errno)); - return; - } - int flags = fcntl(fd, F_GETFD); - if (flags != -1) - fcntl(fd, F_SETFD, flags | FD_CLOEXEC); - - if (ftruncate(fd, alloc) < 0) { - qWarning("ftruncate failed: %s", strerror(errno)); - close(fd); - return; - } - uchar *data = (uchar *) - mmap(NULL, alloc, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - unlink(filename); - - if (data == (uchar *) MAP_FAILED) { - qWarning("mmap /dev/zero failed: %s", strerror(errno)); - close(fd); - return; - } - - mImage = QImage(data, size.width(), size.height(), stride, format); - mShmPool = wl_shm_create_pool(display->shm(), fd, alloc); - mBuffer = wl_shm_pool_create_buffer(mShmPool,0, size.width(), size.height(), - stride, WL_SHM_FORMAT_ARGB8888); - close(fd); -} - -QWaylandShmBuffer::~QWaylandShmBuffer(void) -{ - delete mMarginsImage; - munmap((void *) mImage.constBits(), mImage.byteCount()); - wl_buffer_destroy(mBuffer); - wl_shm_pool_destroy(mShmPool); -} - -QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &margins) -{ - if (!margins.isNull() && margins != mMargins) { - if (mMarginsImage) { - delete mMarginsImage; - } - uchar *bits = const_cast<uchar *>(mImage.constBits()); - uchar *b_s_data = bits + margins.top() * mImage.bytesPerLine() + margins.left() * 4; - int b_s_width = mImage.size().width() - margins.left() - margins.right(); - int b_s_height = mImage.size().height() - margins.top() - margins.bottom(); - mMarginsImage = new QImage(b_s_data, b_s_width,b_s_height,mImage.bytesPerLine(),mImage.format()); - } - if (margins.isNull()) { - delete mMarginsImage; - mMarginsImage = 0; - } - - mMargins = margins; - if (!mMarginsImage) - return &mImage; - - return mMarginsImage; - -} - -QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) - : QPlatformBackingStore(window) - , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display()) - , mFrontBuffer(0) - , mBackBuffer(0) - , mFrontBufferIsDirty(false) - , mPainting(false) - , mFrameCallback(0) -{ - -} - -QWaylandShmBackingStore::~QWaylandShmBackingStore() -{ - if (mFrameCallback) - wl_callback_destroy(mFrameCallback); - -// if (mFrontBuffer == waylandWindow()->attached()) -// waylandWindow()->attach(0); - - if (mFrontBuffer != mBackBuffer) - delete mFrontBuffer; - - delete mBackBuffer; -} - -QPaintDevice *QWaylandShmBackingStore::paintDevice() -{ - if (!windowDecoration()) - return mBackBuffer->image(); - return mBackBuffer->imageInsideMargins(windowDecorationMargins()); -} - -void QWaylandShmBackingStore::beginPaint(const QRegion &) -{ - mPainting = true; - ensureSize(); - - if (waylandWindow()->attached() && mBackBuffer == waylandWindow()->attached() && mFrameCallback) { - QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window()->handle()); - Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); - waylandWindow->waitForFrameSync(); - } - - waylandWindow()->setCanResize(false); -} - -void QWaylandShmBackingStore::endPaint() -{ - mPainting = false; - waylandWindow()->setCanResize(true); -} - -void QWaylandShmBackingStore::ensureSize() -{ - waylandWindow()->setBackingStore(this); - waylandWindow()->createDecoration(); - resize(mRequestedSize); -} - -void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(window); - Q_UNUSED(offset); - Q_ASSERT(waylandWindow()->windowType() == QWaylandWindow::Shm); - - if (windowDecoration() && windowDecoration()->isDirty()) - updateDecorations(); - - mFrontBuffer = mBackBuffer; - - if (mFrameCallback) { - mFrontBufferIsDirty = true; - return; - } - - mFrameCallback = waylandWindow()->frame(); - wl_callback_add_listener(mFrameCallback,&frameCallbackListener,this); - QMargins margins = windowDecorationMargins(); - - bool damageAll = false; - if (waylandWindow()->attached() != mFrontBuffer) { - delete waylandWindow()->attached(); - damageAll = true; - } - waylandWindow()->attachOffset(mFrontBuffer); - - if (damageAll) { - //need to damage it all, otherwise the attach offset may screw up - waylandWindow()->damage(QRect(QPoint(0,0),mFrontBuffer->size())); - } else { - QVector<QRect> rects = region.rects(); - for (int i = 0; i < rects.size(); i++) { - QRect rect = rects.at(i); - rect.translate(margins.left(),margins.top()); - waylandWindow()->damage(rect); - } - } - waylandWindow()->commit(); - mFrontBufferIsDirty = false; -} - -void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) -{ - mRequestedSize = size; -} - -void QWaylandShmBackingStore::resize(const QSize &size) -{ - QMargins margins = windowDecorationMargins(); - QSize sizeWithMargins = size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom()); - - QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); - - if (mBackBuffer != NULL && mBackBuffer->size() == sizeWithMargins) - return; - - if (mBackBuffer != mFrontBuffer) { - delete mBackBuffer; //we delete the attached buffer when we flush - } - - mBackBuffer = new QWaylandShmBuffer(mDisplay, sizeWithMargins, format); - - if (windowDecoration() && window()->isVisible()) - windowDecoration()->update(); -} - -QImage *QWaylandShmBackingStore::entireSurface() const -{ - return mBackBuffer->image(); -} - -void QWaylandShmBackingStore::updateDecorations() -{ - QPainter decorationPainter(entireSurface()); - decorationPainter.setCompositionMode(QPainter::CompositionMode_Source); - QImage sourceImage = windowDecoration()->contentImage(); - QRect target; - //Top - target.setX(0); - target.setY(0); - target.setWidth(sourceImage.width()); - target.setHeight(windowDecorationMargins().top()); - decorationPainter.drawImage(target, sourceImage, target); - - //Left - target.setWidth(windowDecorationMargins().left()); - target.setHeight(sourceImage.height()); - decorationPainter.drawImage(target, sourceImage, target); - - //Right - target.setX(sourceImage.width() - windowDecorationMargins().right()); - decorationPainter.drawImage(target, sourceImage, target); - - //Bottom - target.setX(0); - target.setY(sourceImage.height() - windowDecorationMargins().bottom()); - target.setWidth(sourceImage.width()); - target.setHeight(windowDecorationMargins().bottom()); - decorationPainter.drawImage(target, sourceImage, target); -} - -void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t time) -{ - Q_UNUSED(time); - QWaylandShmBackingStore *self = - static_cast<QWaylandShmBackingStore *>(data); - if (callback != self->mFrameCallback) // others, like QWaylandWindow, may trigger callbacks too - return; - QWaylandShmWindow *window = self->waylandWindow(); - wl_callback_destroy(self->mFrameCallback); - self->mFrameCallback = 0; - - - if (self->mFrontBufferIsDirty && !self->mPainting) { - self->mFrontBufferIsDirty = false; - self->mFrameCallback = wl_surface_frame(window->object()); - wl_callback_add_listener(self->mFrameCallback,&self->frameCallbackListener,self); - if (self->mFrontBuffer != window->attached()) { - delete window->attached(); - } - window->attachOffset(self->mFrontBuffer); - window->damage(QRect(QPoint(0,0),self->mFrontBuffer->size())); - window->commit(); - } -} - -const struct wl_callback_listener QWaylandShmBackingStore::frameCallbackListener = { - QWaylandShmBackingStore::done -}; - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.h b/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.h deleted file mode 100644 index 601173420..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.h +++ /dev/null @@ -1,134 +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 QWAYLANDSHMBACKINGSTORE_H -#define QWAYLANDSHMBACKINGSTORE_H - -#include "qwaylandbuffer.h" - -#include "qwaylanddecoration.h" -#include "qwaylandshmwindow.h" - -#include <qpa/qplatformbackingstore.h> -#include <QtGui/QImage> -#include <qpa/qplatformwindow.h> - -QT_BEGIN_NAMESPACE - -class QWaylandDisplay; - -class QWaylandShmBuffer : public QWaylandBuffer { -public: - QWaylandShmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format); - ~QWaylandShmBuffer(); - QSize size() const { return mImage.size(); } - QImage *image() { return &mImage; } - - QImage *imageInsideMargins(const QMargins &margins); -private: - QImage mImage; - struct wl_shm_pool *mShmPool; - QMargins mMargins; - QImage *mMarginsImage; -}; - -class QWaylandShmBackingStore : public QPlatformBackingStore -{ -public: - QWaylandShmBackingStore(QWindow *window); - ~QWaylandShmBackingStore(); - - QPaintDevice *paintDevice(); - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size, const QRegion &staticContents); - void resize(const QSize &size); - void beginPaint(const QRegion &); - void endPaint(); - - QWaylandDecoration *windowDecoration() const; - - QMargins windowDecorationMargins() const; - QImage *entireSurface() const; - void ensureSize(); - - QWaylandShmWindow *waylandWindow() const; - void iterateBuffer(); - -private: - void updateDecorations(); - - QWaylandDisplay *mDisplay; - QWaylandShmBuffer *mFrontBuffer; - QWaylandShmBuffer *mBackBuffer; - bool mFrontBufferIsDirty; - bool mPainting; - - QSize mRequestedSize; - Qt::WindowFlags mCurrentWindowFlags; - - static const struct wl_callback_listener frameCallbackListener; - static void done(void *data, - struct wl_callback *callback, - uint32_t time); - struct wl_callback *mFrameCallback; -}; - -inline QWaylandDecoration *QWaylandShmBackingStore::windowDecoration() const -{ - return waylandWindow()->decoration(); -} - -inline QMargins QWaylandShmBackingStore::windowDecorationMargins() const -{ - if (windowDecoration()) - return windowDecoration()->margins(); - return QMargins(); -} - -inline QWaylandShmWindow *QWaylandShmBackingStore::waylandWindow() const -{ - return static_cast<QWaylandShmWindow *>(window()->handle()); -} - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/wayland_common/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland_common/qwaylandshmwindow.cpp deleted file mode 100644 index 48a1bfd53..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandshmwindow.cpp +++ /dev/null @@ -1,73 +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 config.tests 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 "qwaylandshmwindow.h" - -#include "qwaylandbuffer.h" - -#include <QtCore/QVector> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -QWaylandShmWindow::QWaylandShmWindow(QWindow *window) - : QWaylandWindow(window) - , mBackingStore(0) -{ -} - -QWaylandShmWindow::~QWaylandShmWindow() -{ - -} - -QWaylandWindow::WindowType QWaylandShmWindow::windowType() const -{ - return QWaylandWindow::Shm; -} - -void QWaylandShmWindow::setBackingStore(QWaylandShmBackingStore *backingStore) -{ - mBackingStore = backingStore; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandshmwindow.h b/src/plugins/platforms/wayland_common/qwaylandshmwindow.h deleted file mode 100644 index ffd11c948..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandshmwindow.h +++ /dev/null @@ -1,75 +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 config.tests 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 QWAYLANDSHMWINDOW_H -#define QWAYLANDSHMWINDOW_H - -#include "qwaylandwindow.h" -#include <QtGui/QRegion> - -QT_BEGIN_NAMESPACE - -class QWaylandShmBackingStore; - -class QWaylandShmWindow : public QWaylandWindow -{ -public: - QWaylandShmWindow(QWindow *window); - ~QWaylandShmWindow(); - - WindowType windowType() const; - QSurfaceFormat format() const { return QSurfaceFormat(); } - - void setBackingStore(QWaylandShmBackingStore *backingStore); - QWaylandShmBackingStore *backingStore() const; - -private: - QWaylandShmBackingStore *mBackingStore; -}; - -inline QWaylandShmBackingStore *QWaylandShmWindow::backingStore() const -{ - return mBackingStore; -} - -QT_END_NAMESPACE - -#endif // QWAYLANDSHMWINDOW_H diff --git a/src/plugins/platforms/wayland_common/qwaylandsubsurface.cpp b/src/plugins/platforms/wayland_common/qwaylandsubsurface.cpp deleted file mode 100644 index 0e9d575a9..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandsubsurface.cpp +++ /dev/null @@ -1,91 +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 "qwaylandsubsurface.h" - -#include "qwaylandwindow.h" - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, struct ::qt_sub_surface *sub_surface) - : QtWayland::qt_sub_surface(sub_surface) - , m_window(window) -{ -} - -void QWaylandSubSurface::setParent(const QWaylandWindow *parent) -{ - QWaylandSubSurface *parentSurface = parent ? parent->subSurfaceWindow() : 0; - if (parentSurface) { - int x = m_window->geometry().x() + parent->frameMargins().left(); - int y = m_window->geometry().y() + parent->frameMargins().top(); - parentSurface->attach_sub_surface(object(), x, y); - } -} - -static void setPositionToParent(QWaylandWindow *parentWaylandWindow) -{ - QObjectList children = parentWaylandWindow->window()->children(); - for (int i = 0; i < children.size(); i++) { - QWindow *childWindow = qobject_cast<QWindow *>(children.at(i)); - if (!childWindow) - continue; - - if (childWindow->handle()) { - QWaylandWindow *waylandWindow = static_cast<QWaylandWindow *>(childWindow->handle()); - waylandWindow->subSurfaceWindow()->setParent(parentWaylandWindow); - setPositionToParent(waylandWindow); - } - } -} - -void QWaylandSubSurface::adjustPositionOfChildren() -{ - QWindow *window = m_window->window(); - if (window->parent()) { - qDebug() << "QWaylandSubSurface::adjustPositionOfChildren not called for toplevel window"; - } - setPositionToParent(m_window); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandtouch.cpp b/src/plugins/platforms/wayland_common/qwaylandtouch.cpp deleted file mode 100644 index 5835d9d3c..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandtouch.cpp +++ /dev/null @@ -1,209 +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 "qwaylandtouch.h" -#include "qwaylandinputdevice.h" - -QT_BEGIN_NAMESPACE - -QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id) - : QtWayland::qt_touch_extension(display->wl_registry(), id), - mDisplay(display), - mTouchDevice(0), - mPointsLeft(0), - mFlags(0), - mMouseSourceId(-1), - mInputDevice(0) -{ -} - -void QWaylandTouchExtension::registerDevice(int caps) -{ - mTouchDevice = new QTouchDevice; - mTouchDevice->setType(QTouchDevice::TouchScreen); - mTouchDevice->setCapabilities(QTouchDevice::Capabilities(caps)); - QWindowSystemInterface::registerTouchDevice(mTouchDevice); -} - -static inline qreal fromFixed(int f) -{ - return f / qreal(10000); -} - -void QWaylandTouchExtension::touch_extension_touch(uint32_t time, - uint32_t id, uint32_t state, int32_t x, int32_t y, - int32_t normalized_x, int32_t normalized_y, - int32_t width, int32_t height, uint32_t pressure, - int32_t velocity_x, int32_t velocity_y, - uint32_t flags, wl_array *rawdata) -{ - if (!mInputDevice) { - QList<QWaylandInputDevice *> inputDevices = mDisplay->inputDevices(); - if (inputDevices.isEmpty()) { - qWarning("qt_touch_extension: handle_touch: No input devices"); - return; - } - mInputDevice = inputDevices.first(); - } - QWaylandWindow *win = mInputDevice->mTouchFocus; - if (!win) - win = mInputDevice->mPointerFocus; - if (!win) - win = mInputDevice->mKeyboardFocus; - if (!win || !win->window()) { - qWarning("qt_touch_extension: handle_touch: No pointer focus"); - return; - } - mTargetWindow = win->window(); - - QWindowSystemInterface::TouchPoint tp; - tp.id = id; - tp.state = Qt::TouchPointState(int(state & 0xFFFF)); - int sentPointCount = state >> 16; - if (!mPointsLeft) { - Q_ASSERT(sentPointCount > 0); - mPointsLeft = sentPointCount; - } - tp.flags = QTouchEvent::TouchPoint::InfoFlags(int(flags & 0xFFFF)); - - if (!mTouchDevice) - registerDevice(flags >> 16); - - tp.area = QRectF(0, 0, fromFixed(width), fromFixed(height)); - // Got surface-relative coords but need a (virtual) screen position. - QPointF relPos = QPointF(fromFixed(x), fromFixed(y)); - QPointF delta = relPos - relPos.toPoint(); - tp.area.moveCenter(mTargetWindow->mapToGlobal(relPos.toPoint()) + delta); - - tp.normalPosition.setX(fromFixed(normalized_x)); - tp.normalPosition.setY(fromFixed(normalized_y)); - tp.pressure = pressure / 255.0; - tp.velocity.setX(fromFixed(velocity_x)); - tp.velocity.setY(fromFixed(velocity_y)); - - if (rawdata) { - const int rawPosCount = rawdata->size / sizeof(float) / 2; - float *p = static_cast<float *>(rawdata->data); - for (int i = 0; i < rawPosCount; ++i) { - float x = *p++; - float y = *p++; - tp.rawPositions.append(QPointF(x, y)); - } - } - - mTouchPoints.append(tp); - mTimestamp = time; - - if (!--mPointsLeft) - sendTouchEvent(); -} - -void QWaylandTouchExtension::sendTouchEvent() -{ - // Copy all points, that are in the previous but not in the current list, as stationary. - for (int i = 0; i < mPrevTouchPoints.count(); ++i) { - const QWindowSystemInterface::TouchPoint &prevPoint(mPrevTouchPoints.at(i)); - if (prevPoint.state == Qt::TouchPointReleased) - continue; - bool found = false; - for (int j = 0; j < mTouchPoints.count(); ++j) - if (mTouchPoints.at(j).id == prevPoint.id) { - found = true; - break; - } - if (!found) { - QWindowSystemInterface::TouchPoint p = prevPoint; - p.state = Qt::TouchPointStationary; - mTouchPoints.append(p); - } - } - - if (mTouchPoints.isEmpty()) { - mPrevTouchPoints.clear(); - return; - } - - QWindowSystemInterface::handleTouchEvent(mTargetWindow, mTimestamp, mTouchDevice, mTouchPoints); - - Qt::TouchPointStates states = 0; - for (int i = 0; i < mTouchPoints.count(); ++i) - states |= mTouchPoints.at(i).state; - - if (mFlags & QT_TOUCH_EXTENSION_FLAGS_MOUSE_FROM_TOUCH) { - if (states == Qt::TouchPointPressed) - mMouseSourceId = mTouchPoints.first().id; - for (int i = 0; i < mTouchPoints.count(); ++i) { - const QWindowSystemInterface::TouchPoint &tp(mTouchPoints.at(i)); - if (tp.id == mMouseSourceId) { - Qt::MouseButtons buttons = tp.state == Qt::TouchPointReleased ? Qt::NoButton : Qt::LeftButton; - mLastMouseGlobal = tp.area.center(); - QPoint globalPoint = mLastMouseGlobal.toPoint(); - QPointF delta = mLastMouseGlobal - globalPoint; - mLastMouseLocal = mTargetWindow->mapFromGlobal(globalPoint) + delta; - QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, buttons); - if (buttons == Qt::NoButton) - mMouseSourceId = -1; - break; - } - } - } - - mPrevTouchPoints = mTouchPoints; - mTouchPoints.clear(); - - if (states == Qt::TouchPointReleased) - mPrevTouchPoints.clear(); -} - -void QWaylandTouchExtension::touchCanceled() -{ - mTouchPoints.clear(); - mPrevTouchPoints.clear(); - if (mMouseSourceId != -1) - QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, Qt::NoButton); -} - -void QWaylandTouchExtension::touch_extension_configure(uint32_t flags) -{ - mFlags = flags; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandtouch.h b/src/plugins/platforms/wayland_common/qwaylandtouch.h deleted file mode 100644 index 3762209dc..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandtouch.h +++ /dev/null @@ -1,97 +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 QWAYLANDTOUCh_H -#define QWAYLANDTOUCH_H - -#include "qwaylanddisplay.h" -#include <qpa/qwindowsysteminterface.h> - -#include <qwayland-touch-extension.h> - -QT_BEGIN_NAMESPACE - -class QWaylandTouchExtension : public QtWayland::qt_touch_extension -{ -public: - QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id); - - void touchCanceled(); - -private: - void registerDevice(int caps); - - QWaylandDisplay *mDisplay; - - void touch_extension_touch(uint32_t time, - uint32_t id, - uint32_t state, - int32_t x, - int32_t y, - int32_t normalized_x, - int32_t normalized_y, - int32_t width, - int32_t height, - uint32_t pressure, - int32_t velocity_x, - int32_t velocity_y, - uint32_t flags, - struct wl_array *rawdata) Q_DECL_OVERRIDE; - void touch_extension_configure(uint32_t flags) Q_DECL_OVERRIDE; - - void sendTouchEvent(); - - QList<QWindowSystemInterface::TouchPoint> mTouchPoints; - QList<QWindowSystemInterface::TouchPoint> mPrevTouchPoints; - QTouchDevice *mTouchDevice; - uint32_t mTimestamp; - int mPointsLeft; - uint32_t mFlags; - int mMouseSourceId; - QPointF mLastMouseLocal; - QPointF mLastMouseGlobal; - QWindow *mTargetWindow; - QWaylandInputDevice *mInputDevice; -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDTOUCH_H diff --git a/src/plugins/platforms/wayland_common/qwaylandwindow.cpp b/src/plugins/platforms/wayland_common/qwaylandwindow.cpp deleted file mode 100644 index 27b624fb2..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandwindow.cpp +++ /dev/null @@ -1,578 +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 config.tests 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 "qwaylandwindow.h" - -#include "qwaylandbuffer.h" -#include "qwaylanddisplay.h" -#include "qwaylandinputdevice.h" -#include "qwaylandscreen.h" -#include "qwaylandshellsurface.h" -#include "qwaylandextendedsurface.h" -#include "qwaylandsubsurface.h" -#include "qwaylanddecoration.h" -#include "qwaylandwindowmanagerintegration.h" - -#include <QtCore/QFileInfo> -#include <QtGui/QWindow> - -#include <QGuiApplication> -#include <qpa/qwindowsysteminterface.h> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -QWaylandWindow::QWaylandWindow(QWindow *window) - : QObject() - , QPlatformWindow(window) - , mScreen(QWaylandScreen::waylandScreenFromWindow(window)) - , mDisplay(mScreen->display()) - , mShellSurface(0) - , mExtendedWindow(0) - , mSubSurfaceWindow(0) - , mWindowDecoration(0) - , mMouseEventsInContentArea(false) - , mMousePressedInContentArea(Qt::NoButton) - , mBuffer(0) - , mWaitingForFrameSync(false) - , mFrameCallback(0) - , mRequestResizeSent(false) - , mCanResize(true) - , mSentInitialResize(false) - , mMouseDevice(0) - , mMouseSerial(0) - , mState(Qt::WindowNoState) -{ - init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this))); - - static WId id = 1; - mWindowId = id++; - - if (mDisplay->shell() && window->type() & Qt::Window && !(window->flags() & Qt::BypassWindowManagerHint)) - mShellSurface = new QWaylandShellSurface(mDisplay->shell()->get_shell_surface(object()), this); - if (mDisplay->windowExtension()) - mExtendedWindow = new QWaylandExtendedSurface(this, mDisplay->windowExtension()->get_extended_surface(object())); - if (mDisplay->subSurfaceExtension()) - mSubSurfaceWindow = new QWaylandSubSurface(this, mDisplay->subSurfaceExtension()->get_sub_surface_aware_surface(object())); - - if (mShellSurface) { - // Set surface class to the .desktop file name (obtained from executable name) - QFileInfo exeFileInfo(qApp->applicationFilePath()); - QString className = exeFileInfo.baseName() + QLatin1String(".desktop"); - mShellSurface->set_class(className); - } - - if (QPlatformWindow::parent() && mSubSurfaceWindow) { - mSubSurfaceWindow->setParent(static_cast<const QWaylandWindow *>(QPlatformWindow::parent())); - } else if (window->transientParent() && mShellSurface) { - if (window->type() != Qt::Popup) { - mShellSurface->updateTransientParent(window->transientParent()); - } - } else if (mShellSurface) { - mShellSurface->setTopLevel(); - } - - setWindowFlags(window->flags()); - setGeometry(window->geometry()); - -} - -QWaylandWindow::~QWaylandWindow() -{ - if (isInitialized()) { - delete mShellSurface; - delete mExtendedWindow; - destroy(); - } - if (mFrameCallback) - wl_callback_destroy(mFrameCallback); - - QList<QWaylandInputDevice *> inputDevices = mDisplay->inputDevices(); - for (int i = 0; i < inputDevices.size(); ++i) - inputDevices.at(i)->handleWindowDestroyed(this); - - const QWindow *parent = window(); - foreach (QWindow *w, QGuiApplication::topLevelWindows()) { - if (w->transientParent() == parent) - QWindowSystemInterface::handleCloseEvent(w); - } -} - -QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) -{ - return static_cast<QWaylandWindow *>(static_cast<QtWayland::wl_surface *>(wl_surface_get_user_data(surface))); -} - -WId QWaylandWindow::winId() const -{ - return mWindowId; -} - -void QWaylandWindow::setParent(const QPlatformWindow *parent) -{ - const QWaylandWindow *parentWaylandWindow = static_cast<const QWaylandWindow *>(parent); - if (subSurfaceWindow()) { - subSurfaceWindow()->setParent(parentWaylandWindow); - } -} - -void QWaylandWindow::setWindowTitle(const QString &title) -{ - if (mShellSurface) { - mShellSurface->set_title(title); - } - - if (mWindowDecoration && window()->isVisible()) - mWindowDecoration->update(); -} - -void QWaylandWindow::setWindowIcon(const QIcon &icon) -{ - mWindowIcon = icon; - - if (mWindowDecoration && window()->isVisible()) - mWindowDecoration->update(); -} - -void QWaylandWindow::setGeometry(const QRect &rect) -{ - QPlatformWindow::setGeometry(rect); - - if (shellSurface() && window()->transientParent()) - shellSurface()->updateTransientParent(window()->transientParent()); - - if (mWindowDecoration && window()->isVisible()) - mWindowDecoration->update(); - - if (mConfigure.isEmpty()) { - QWindowSystemInterface::handleGeometryChange(window(), rect); - QWindowSystemInterface::handleExposeEvent(window(), QRegion(rect)); - } -} - -void QWaylandWindow::setVisible(bool visible) -{ - if (visible) { - if (mBuffer) - attach(mBuffer->buffer(), 0, 0); - - if (window()->type() == Qt::Popup && transientParent()) { - QWaylandWindow *parent = transientParent(); - mMouseDevice = parent->mMouseDevice; - mMouseSerial = parent->mMouseSerial; - - mShellSurface->setPopup(transientParent(), mMouseDevice, mMouseSerial); - } - - if (!mSentInitialResize) { - QWindowSystemInterface::handleGeometryChange(window(), geometry()); - mSentInitialResize = true; - } - - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); - // Don't flush the events here, or else the newly visible window may start drawing, but since - // there was no frame before it will be stuck at the waitForFrameSync() in - // QWaylandShmBackingStore::beginPaint(). - } else { - QWindowSystemInterface::handleExposeEvent(window(), QRegion()); - attach(static_cast<QWaylandBuffer *>(0), 0, 0); - } - damage(QRect(QPoint(0,0),geometry().size())); - commit(); -} - - -void QWaylandWindow::raise() -{ - if (mExtendedWindow) - mExtendedWindow->raise(); -} - - -void QWaylandWindow::lower() -{ - if (mExtendedWindow) - mExtendedWindow->lower(); -} - -void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height) -{ - QMutexLocker resizeLocker(&mResizeLock); - mConfigure.edges |= edges; - mConfigure.width = width; - mConfigure.height = height; - - if (!mRequestResizeSent && !mConfigure.isEmpty()) { - mRequestResizeSent= true; - QMetaObject::invokeMethod(this, "requestResize", Qt::QueuedConnection); - } -} - -void QWaylandWindow::doResize() -{ - if (mConfigure.isEmpty()) { - return; - } - - int widthWithoutMargins = qMax(mConfigure.width-(frameMargins().left() +frameMargins().right()),1); - int heightWithoutMargins = qMax(mConfigure.height-(frameMargins().top()+frameMargins().bottom()),1); - - widthWithoutMargins = qMax(widthWithoutMargins, window()->minimumSize().width()); - heightWithoutMargins = qMax(heightWithoutMargins, window()->minimumSize().height()); - QRect geometry = QRect(0,0, widthWithoutMargins, heightWithoutMargins); - - int x = 0; - int y = 0; - QSize size = this->geometry().size(); - if (mConfigure.edges & WL_SHELL_SURFACE_RESIZE_LEFT) { - x = size.width() - geometry.width(); - } - if (mConfigure.edges & WL_SHELL_SURFACE_RESIZE_TOP) { - y = size.height() - geometry.height(); - } - mOffset += QPoint(x, y); - - setGeometry(geometry); - - mConfigure.clear(); - QWindowSystemInterface::handleGeometryChange(window(), geometry); -} - -void QWaylandWindow::setCanResize(bool canResize) -{ - QMutexLocker lock(&mResizeLock); - mCanResize = canResize; - - if (canResize && !mConfigure.isEmpty()) { - doResize(); - QWindowSystemInterface::handleExposeEvent(window(), geometry()); - } -} - -void QWaylandWindow::requestResize() -{ - QMutexLocker lock(&mResizeLock); - - if (mCanResize) { - doResize(); - } - - mRequestResizeSent = false; - lock.unlock(); - QWindowSystemInterface::handleExposeEvent(window(), geometry()); - QWindowSystemInterface::flushWindowSystemEvents(); -} - -void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) -{ - mBuffer = buffer; - - if (mBuffer) - attach(mBuffer->buffer(), x, y); - else - QtWayland::wl_surface::attach(0, 0, 0); -} - -void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) -{ - attach(buffer, mOffset.x(), mOffset.y()); - mOffset = QPoint(); -} - -QWaylandBuffer *QWaylandWindow::attached() const -{ - return mBuffer; -} - -void QWaylandWindow::damage(const QRect &rect) -{ - //We have to do sync stuff before calling damage, or we might - //get a frame callback before we get the timestamp - if (!mWaitingForFrameSync) { - mFrameCallback = frame(); - wl_callback_add_listener(mFrameCallback,&QWaylandWindow::callbackListener,this); - mWaitingForFrameSync = true; - } - if (mBuffer) { - damage(rect.x(), rect.y(), rect.width(), rect.height()); - } -} - -const wl_callback_listener QWaylandWindow::callbackListener = { - QWaylandWindow::frameCallback -}; - -void QWaylandWindow::frameCallback(void *data, struct wl_callback *callback, uint32_t time) -{ - Q_UNUSED(time); - QWaylandWindow *self = static_cast<QWaylandWindow*>(data); - if (callback != self->mFrameCallback) // might be a callback caused by the shm backingstore - return; - self->mWaitingForFrameSync = false; - if (self->mFrameCallback) { - wl_callback_destroy(self->mFrameCallback); - self->mFrameCallback = 0; - } -} - -QMutex QWaylandWindow::mFrameSyncMutex; - -void QWaylandWindow::waitForFrameSync() -{ - QMutexLocker locker(&mFrameSyncMutex); - if (!mWaitingForFrameSync) - return; - mDisplay->flushRequests(); - while (mWaitingForFrameSync) - mDisplay->blockingReadEvents(); -} - -QMargins QWaylandWindow::frameMargins() const -{ - if (mWindowDecoration) - return mWindowDecoration->margins(); - return QPlatformWindow::frameMargins(); -} - -QWaylandShellSurface *QWaylandWindow::shellSurface() const -{ - return mShellSurface; -} - -QWaylandExtendedSurface *QWaylandWindow::extendedWindow() const -{ - return mExtendedWindow; -} - -QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const -{ - return mSubSurfaceWindow; -} - -void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) -{ - if (mExtendedWindow) - mExtendedWindow->setContentOrientation(orientation); -} - -void QWaylandWindow::setWindowState(Qt::WindowState state) -{ - if (mState == state) { - return; - } - - // As of february 2013 QWindow::setWindowState sets the new state value after - // QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState - // here. We use then this mState variable. - mState = state; - createDecoration(); - switch (state) { - case Qt::WindowFullScreen: - mShellSurface->setFullscreen(); - break; - case Qt::WindowMaximized: - mShellSurface->setMaximized(); - break; - case Qt::WindowMinimized: - mShellSurface->setMinimized(); - break; - default: - mShellSurface->setNormal(); - } - - QWindowSystemInterface::handleWindowStateChanged(window(), mState); - QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged -} - -void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) -{ - if (mExtendedWindow) - mExtendedWindow->setWindowFlags(flags); -} - -bool QWaylandWindow::createDecoration() -{ - static bool disableWaylandDecorations = !qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").isEmpty(); - if (disableWaylandDecorations) - return false; - - bool decoration = false; - switch (window()->type()) { - case Qt::Window: - case Qt::Widget: - case Qt::Dialog: - case Qt::Tool: - case Qt::Drawer: - decoration = true; - break; - default: - break; - } - if (window()->flags() & Qt::FramelessWindowHint || isFullscreen()) - decoration = false; - if (window()->flags() & Qt::BypassWindowManagerHint) - decoration = false; - - if (decoration) { - if (!mWindowDecoration) - mWindowDecoration = new QWaylandDecoration(this); - } else { - delete mWindowDecoration; - mWindowDecoration = 0; - } - - return mWindowDecoration; -} - -QWaylandDecoration *QWaylandWindow::decoration() const -{ - return mWindowDecoration; -} - -void QWaylandWindow::setDecoration(QWaylandDecoration *decoration) -{ - mWindowDecoration = decoration; - if (subSurfaceWindow()) { - subSurfaceWindow()->adjustPositionOfChildren(); - } -} - -static QWindow *topLevelWindow(QWindow *window) -{ - while (QWindow *parent = window->parent()) - window = parent; - return window; -} - -QWaylandWindow *QWaylandWindow::transientParent() const -{ - if (window()->transientParent()) { - // Take the top level window here, since the transient parent may be a QWidgetWindow - // or some other window without a shell surface, which is then not able to get mouse - // events, nor set mMouseSerial and mMouseDevice. - return static_cast<QWaylandWindow *>(topLevelWindow(window()->transientParent())->handle()); - } - return 0; -} - -void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) -{ - if (b != Qt::NoButton) { - mMouseSerial = inputDevice->serial(); - mMouseDevice = inputDevice; - } - - if (mWindowDecoration) { - handleMouseEventWithDecoration(inputDevice, timestamp,local,global,b,mods); - return; - } - - QWindowSystemInterface::handleMouseEvent(window(),timestamp,local,global,b,mods); -} - -void QWaylandWindow::handleMouseEnter(QWaylandInputDevice *inputDevice) -{ - if (!mWindowDecoration) { - QWindowSystemInterface::handleEnterEvent(window()); - } - restoreMouseCursor(inputDevice); -} - -void QWaylandWindow::handleMouseLeave(QWaylandInputDevice *inputDevice) -{ - if (mWindowDecoration) { - if (mMouseEventsInContentArea) { - QWindowSystemInterface::handleLeaveEvent(window()); - } - } else { - QWindowSystemInterface::handleLeaveEvent(window()); - } - restoreMouseCursor(inputDevice); -} - -void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) -{ - if (mWindowDecoration->handleMouse(inputDevice,local,global,b,mods)) - return; - - QMargins marg = frameMargins(); - QRect windowRect(0 + marg.left(), - 0 + marg.top(), - geometry().size().width() - marg.right(), - geometry().size().height() - marg.bottom()); - if (windowRect.contains(local.toPoint()) || mMousePressedInContentArea != Qt::NoButton) { - QPointF localTranslated = local; - QPointF globalTranslated = global; - localTranslated.setX(localTranslated.x() - marg.left()); - localTranslated.setY(localTranslated.y() - marg.top()); - globalTranslated.setX(globalTranslated.x() - marg.left()); - globalTranslated.setY(globalTranslated.y() - marg.top()); - if (!mMouseEventsInContentArea) { - restoreMouseCursor(inputDevice); - QWindowSystemInterface::handleEnterEvent(window()); - } - QWindowSystemInterface::handleMouseEvent(window(), timestamp, localTranslated, globalTranslated, b, mods); - mMouseEventsInContentArea = true; - mMousePressedInContentArea = b; - } else { - if (mMouseEventsInContentArea) { - QWindowSystemInterface::handleLeaveEvent(window()); - mMouseEventsInContentArea = false; - } - mWindowDecoration->handleMouse(inputDevice,local,global,b,mods); - } -} - -void QWaylandWindow::setMouseCursor(QWaylandInputDevice *device, Qt::CursorShape shape) -{ - if (m_cursorShape != shape || device->serial() > device->cursorSerial()) { - device->setCursor(shape, mScreen); - m_cursorShape = shape; - } -} - -void QWaylandWindow::restoreMouseCursor(QWaylandInputDevice *device) -{ - setMouseCursor(device, window()->cursor().shape()); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandwindow.h b/src/plugins/platforms/wayland_common/qwaylandwindow.h deleted file mode 100644 index 8fd104d0a..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandwindow.h +++ /dev/null @@ -1,226 +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 config.tests 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 QWAYLANDWINDOW_H -#define QWAYLANDWINDOW_H - -#include <QtCore/QWaitCondition> -#include <QtCore/QMutex> -#include <QtGui/QIcon> - -#include <qpa/qplatformwindow.h> - -#include "qwaylanddisplay.h" - -#include "qwayland-wayland.h" - -struct wl_egl_window; - -QT_BEGIN_NAMESPACE - -class QWaylandDisplay; -class QWaylandBuffer; -class QWaylandShellSurface; -class QWaylandExtendedSurface; -class QWaylandSubSurface; -class QWaylandDecoration; - -class QWaylandWindowConfigure -{ -public: - QWaylandWindowConfigure() - : width(0) - , height(0) - , edges(0) - { } - - void clear() - { width = height = edges = 0; } - - bool isEmpty() const - { return !height || !width; } - - int width; - int height; - uint32_t edges; -}; - -class QWaylandWindow : public QObject, public QPlatformWindow, public QtWayland::wl_surface -{ - Q_OBJECT -public: - enum WindowType { - Shm, - Egl - }; - - QWaylandWindow(QWindow *window); - ~QWaylandWindow(); - - virtual WindowType windowType() const = 0; - WId winId() const; - void setVisible(bool visible); - void setParent(const QPlatformWindow *parent); - - void setWindowTitle(const QString &title); - - inline QIcon windowIcon() const; - void setWindowIcon(const QIcon &icon); - - void setGeometry(const QRect &rect); - - void configure(uint32_t edges, int32_t width, int32_t height); - - using QtWayland::wl_surface::attach; - void attach(QWaylandBuffer *buffer, int x, int y); - void attachOffset(QWaylandBuffer *buffer); - QWaylandBuffer *attached() const; - QPoint attachOffset() const; - - using QtWayland::wl_surface::damage; - void damage(const QRect &rect); - - void waitForFrameSync(); - - QMargins frameMargins() const; - - static QWaylandWindow *fromWlSurface(::wl_surface *surface); - - QWaylandShellSurface *shellSurface() const; - QWaylandExtendedSurface *extendedWindow() const; - QWaylandSubSurface *subSurfaceWindow() const; - - void handleContentOrientationChange(Qt::ScreenOrientation orientation); - - void setWindowState(Qt::WindowState state); - void setWindowFlags(Qt::WindowFlags flags); - - void raise() Q_DECL_OVERRIDE; - void lower() Q_DECL_OVERRIDE; - - QWaylandDecoration *decoration() const; - void setDecoration(QWaylandDecoration *decoration); - - - void handleMouse(QWaylandInputDevice *inputDevice, - ulong timestamp, - const QPointF & local, - const QPointF & global, - Qt::MouseButtons b, - Qt::KeyboardModifiers mods); - void handleMouseEnter(QWaylandInputDevice *inputDevice); - void handleMouseLeave(QWaylandInputDevice *inputDevice); - - bool createDecoration(); - - inline bool isMaximized() const { return mState == Qt::WindowMaximized; } - inline bool isFullscreen() const { return mState == Qt::WindowFullScreen; } - - void setMouseCursor(QWaylandInputDevice *device, Qt::CursorShape shape); - void restoreMouseCursor(QWaylandInputDevice *device); - - QWaylandWindow *transientParent() const; - - QMutex *resizeMutex() { return &mResizeLock; } - void doResize(); - void setCanResize(bool canResize); -public slots: - void requestResize(); - -protected: - QWaylandScreen *mScreen; - QWaylandDisplay *mDisplay; - QWaylandShellSurface *mShellSurface; - QWaylandExtendedSurface *mExtendedWindow; - QWaylandSubSurface *mSubSurfaceWindow; - - QWaylandDecoration *mWindowDecoration; - bool mMouseEventsInContentArea; - Qt::MouseButtons mMousePressedInContentArea; - Qt::CursorShape m_cursorShape; - - QWaylandBuffer *mBuffer; - WId mWindowId; - bool mWaitingForFrameSync; - struct wl_callback *mFrameCallback; - QWaitCondition mFrameSyncWait; - - QMutex mResizeLock; - QWaylandWindowConfigure mConfigure; - bool mRequestResizeSent; - bool mCanResize; - - bool mSentInitialResize; - QPoint mOffset; - - QIcon mWindowIcon; - QWaylandInputDevice *mMouseDevice; - int mMouseSerial; - - Qt::WindowState mState; - -private: - void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, - ulong timestamp, - const QPointF & local, - const QPointF & global, - Qt::MouseButtons b, - Qt::KeyboardModifiers mods); - - static const wl_callback_listener callbackListener; - static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time); - - static QMutex mFrameSyncMutex; -}; - -inline QIcon QWaylandWindow::windowIcon() const -{ - return mWindowIcon; -} - -inline QPoint QWaylandWindow::attachOffset() const -{ - return mOffset; -} - -QT_END_NAMESPACE - -#endif // QWAYLANDWINDOW_H diff --git a/src/plugins/platforms/wayland_common/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland_common/qwaylandwindowmanagerintegration.cpp deleted file mode 100644 index 7543ba13c..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandwindowmanagerintegration.cpp +++ /dev/null @@ -1,159 +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 "qwaylandwindowmanagerintegration.h" -#include "qwaylandscreen.h" -#include "qwaylandwindow.h" - -#include <stdint.h> -#include <QtCore/QEvent> -#include <QtCore/QHash> -#include <QtCore/QUrl> -#include <qpa/qplatformnativeinterface.h> -#include <qpa/qplatformwindow.h> -#include <QtGui/QtEvents> -#include <QtGui/QGuiApplication> - -#include <QDebug> - -QT_BEGIN_NAMESPACE - -class QWaylandWindowManagerIntegrationPrivate { -public: - QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay); - bool m_blockPropertyUpdates; - QWaylandDisplay *m_waylandDisplay; - QHash<QWindow*, QVariantMap> m_queuedProperties; - bool m_showIsFullScreen; -}; - -QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay) - : m_blockPropertyUpdates(false) - , m_waylandDisplay(waylandDisplay) - , m_showIsFullScreen(false) -{ - -} - -QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay) - : d_ptr(new QWaylandWindowManagerIntegrationPrivate(waylandDisplay)) -{ - waylandDisplay->addRegistryListener(&wlHandleListenerGlobal, this); -} - -QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration() -{ - -} - -bool QWaylandWindowManagerIntegration::showIsFullScreen() const -{ - Q_D(const QWaylandWindowManagerIntegration); - return d->m_showIsFullScreen; -} - -void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(void *data, wl_registry *registry, uint32_t id, const QString &interface, uint32_t version) -{ - Q_UNUSED(version); - if (interface == "qt_windowmanager") - static_cast<QWaylandWindowManagerIntegration *>(data)->init(registry, id); -} - -void QWaylandWindowManagerIntegration::windowmanager_hints(int32_t showIsFullScreen) -{ - Q_D(QWaylandWindowManagerIntegration); - d->m_showIsFullScreen = showIsFullScreen; -} - -void QWaylandWindowManagerIntegration::windowmanager_quit() -{ - QGuiApplication::quit(); -} - -QByteArray QWaylandWindowManagerIntegration::desktopEnvironment() const -{ - const QByteArray xdgCurrentDesktop = qgetenv("XDG_CURRENT_DESKTOP"); - if (!xdgCurrentDesktop.isEmpty()) - return xdgCurrentDesktop.toUpper(); // KDE, GNOME, UNITY, LXDE, MATE, XFCE... - - // Classic fallbacks - if (!qEnvironmentVariableIsEmpty("KDE_FULL_SESSION")) - return QByteArrayLiteral("KDE"); - if (!qEnvironmentVariableIsEmpty("GNOME_DESKTOP_SESSION_ID")) - return QByteArrayLiteral("GNOME"); - - // Fallback to checking $DESKTOP_SESSION (unreliable) - const QByteArray desktopSession = qgetenv("DESKTOP_SESSION"); - if (desktopSession == "gnome") - return QByteArrayLiteral("GNOME"); - if (desktopSession == "xfce") - return QByteArrayLiteral("XFCE"); - - return QByteArrayLiteral("UNKNOWN"); -} - -void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url) -{ - if (isInitialized()) { - QByteArray data = url.toString().toUtf8(); - - static const int chunkSize = 128; - while (!data.isEmpty()) { - QByteArray chunk = data.left(chunkSize); - data = data.mid(chunkSize); - open_url(!data.isEmpty(), QString::fromUtf8(chunk)); - } - } -} - -bool QWaylandWindowManagerIntegration::openUrl(const QUrl &url) -{ - openUrl_helper(url); - return true; -} - -bool QWaylandWindowManagerIntegration::openDocument(const QUrl &url) -{ - openUrl_helper(url); - return true; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland_common/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland_common/qwaylandwindowmanagerintegration.h deleted file mode 100644 index 4524ce121..000000000 --- a/src/plugins/platforms/wayland_common/qwaylandwindowmanagerintegration.h +++ /dev/null @@ -1,89 +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 QWAYLANDWINDOWMANAGERINTEGRATION_H -#define QWAYLANDWINDOWMANAGERINTEGRATION_H - -#include <QtCore/QObject> -#include <QtCore/QScopedPointer> - -#include "wayland-client.h" -#include "qwaylanddisplay.h" -#include <qpa/qplatformservices.h> - -#include "qwayland-windowmanager.h" - -QT_BEGIN_NAMESPACE - -class QWaylandWindow; - -class QWaylandWindowManagerIntegrationPrivate; - -class QWaylandWindowManagerIntegration : public QObject, public QPlatformServices, public QtWayland::qt_windowmanager -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandWindowManagerIntegration) -public: - explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay); - virtual ~QWaylandWindowManagerIntegration(); - - QByteArray desktopEnvironment() const; - - bool openUrl(const QUrl &url); - bool openDocument(const QUrl &url); - - bool showIsFullScreen() const; - -private: - static void wlHandleListenerGlobal(void *data, wl_registry *registry, uint32_t id, - const QString &interface, uint32_t version); - - QScopedPointer<QWaylandWindowManagerIntegrationPrivate> d_ptr; - - void windowmanager_hints(int32_t showIsFullScreen) Q_DECL_OVERRIDE; - void windowmanager_quit() Q_DECL_OVERRIDE; - - void openUrl_helper(const QUrl &url); -}; - -QT_END_NAMESPACE - -#endif // QWAYLANDWINDOWMANAGERINTEGRATION_H diff --git a/src/plugins/platforms/wayland_common/wayland_common.pri b/src/plugins/platforms/wayland_common/wayland_common.pri deleted file mode 100644 index cc956a722..000000000 --- a/src/plugins/platforms/wayland_common/wayland_common.pri +++ /dev/null @@ -1,10 +0,0 @@ -#This file(wayland_common.pri) is included from .pro files of GL integrations. - -include ($$PWD/wayland_common_share.pri) - -INCLUDEPATH += $$PWD - -staticlib = $$shadowed($$PWD)/$${QMAKE_PREFIX_STATICLIB}wayland_common.$${QMAKE_EXTENSION_STATICLIB} -LIBS += $$staticlib -PRE_TARGETDEPS += $$staticlib - diff --git a/src/plugins/platforms/wayland_common/wayland_common.pro b/src/plugins/platforms/wayland_common/wayland_common.pro deleted file mode 100644 index d8aedb65f..000000000 --- a/src/plugins/platforms/wayland_common/wayland_common.pro +++ /dev/null @@ -1,72 +0,0 @@ -TEMPLATE = lib -CONFIG += staticlib - -include ($$PWD/wayland_common_share.pri) - -SOURCES += qwaylandintegration.cpp \ - qwaylandnativeinterface.cpp \ - qwaylandshmbackingstore.cpp \ - qwaylandinputdevice.cpp \ - qwaylandcursor.cpp \ - qwaylanddisplay.cpp \ - qwaylandwindow.cpp \ - qwaylandscreen.cpp \ - qwaylandshmwindow.cpp \ - qwaylandclipboard.cpp \ - qwaylanddnd.cpp \ - qwaylanddataoffer.cpp \ - qwaylanddatadevicemanager.cpp \ - qwaylanddatasource.cpp \ - qwaylandshellsurface.cpp \ - qwaylandextendedoutput.cpp \ - qwaylandextendedsurface.cpp \ - qwaylandsubsurface.cpp \ - qwaylandtouch.cpp \ - qwaylandqtkey.cpp \ - ../../../shared/qwaylandmimehelper.cpp \ - qwaylanddecoration.cpp \ - qwaylandeventthread.cpp\ - qwaylandwindowmanagerintegration.cpp - -HEADERS += qwaylandintegration.h \ - qwaylandnativeinterface.h \ - qwaylandcursor.h \ - qwaylanddisplay.h \ - qwaylandwindow.h \ - qwaylandscreen.h \ - qwaylandshmbackingstore.h \ - qwaylandinputdevice.h \ - qwaylandbuffer.h \ - qwaylandshmwindow.h \ - qwaylandclipboard.h \ - qwaylanddnd.h \ - qwaylanddataoffer.h \ - qwaylanddatadevicemanager.h \ - qwaylanddatasource.h \ - qwaylandshellsurface.h \ - qwaylandextendedoutput.h \ - qwaylandextendedsurface.h \ - qwaylandsubsurface.h \ - qwaylandtouch.h \ - qwaylandqtkey.h \ - ../../../shared/qwaylandmimehelper.h \ - qwaylanddecoration.h \ - qwaylandeventthread.h \ - qwaylandwindowmanagerintegration.h - -contains(DEFINES, QT_WAYLAND_GL_SUPPORT) { - SOURCES += qwaylandglintegration.cpp - HEADERS += qwaylandglintegration.h -} - -WAYLANDCLIENTSOURCES += \ - ../../../extensions/surface-extension.xml \ - ../../../extensions/sub-surface-extension.xml \ - ../../../extensions/output-extension.xml \ - ../../../extensions/touch-extension.xml \ - ../../../extensions/qtkey-extension.xml \ - ../../../extensions/windowmanager.xml \ - -PLUGIN_TYPE = platforms - -load(qt_common) diff --git a/src/plugins/platforms/wayland_common/wayland_common_share.pri b/src/plugins/platforms/wayland_common/wayland_common_share.pri deleted file mode 100644 index a9a990b43..000000000 --- a/src/plugins/platforms/wayland_common/wayland_common_share.pri +++ /dev/null @@ -1,26 +0,0 @@ -QT += core-private gui-private platformsupport-private -CONFIG += link_pkgconfig qpa/genericunixfontdatabase - -!equals(QT_WAYLAND_GL_CONFIG, nogl) { - DEFINES += QT_WAYLAND_GL_SUPPORT -} - -config_xkbcommon { - !contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += xkbcommon - } else { - LIBS += -lxkbcommon - } -} else { - DEFINES += QT_NO_WAYLAND_XKB -} - -!contains(QT_CONFIG, no-pkg-config) { - PKGCONFIG += wayland-client wayland-cursor -} else { - LIBS += -lwayland-client -lwayland-cursor -} - -INCLUDEPATH += $$PWD/../../../shared - -WAYLANDCLIENTSOURCES += ../../../3rdparty/protocol/wayland.xml diff --git a/src/plugins/platforms/xcomposite_share/qwaylandxcompositebuffer.cpp b/src/plugins/platforms/xcomposite_share/qwaylandxcompositebuffer.cpp deleted file mode 100644 index c65ad4a1a..000000000 --- a/src/plugins/platforms/xcomposite_share/qwaylandxcompositebuffer.cpp +++ /dev/null @@ -1,63 +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 "qwaylandxcompositebuffer.h" - -#include "wayland-client.h" -#include "wayland-xcomposite-client-protocol.h" - -QT_BEGIN_NAMESPACE - -QWaylandXCompositeBuffer::QWaylandXCompositeBuffer(qt_xcomposite *xcomposite, uint32_t window, const QSize &size) - :mSize(size) -{ - mBuffer = qt_xcomposite_create_buffer(xcomposite, - window, - size.width(), - size.height()); -} - -QSize QWaylandXCompositeBuffer::size() const -{ - return mSize; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcomposite_share/xcomposite_share.pri b/src/plugins/platforms/xcomposite_share/xcomposite_share.pri deleted file mode 100644 index 77d56f4c5..000000000 --- a/src/plugins/platforms/xcomposite_share/xcomposite_share.pri +++ /dev/null @@ -1,9 +0,0 @@ -INCLUDEPATH += $$PWD - -WAYLANDCLIENTSOURCES += $$PWD/../../../extensions/xcomposite.xml - -HEADERS += \ - $$PWD/qwaylandxcompositebuffer.h - -SOURCES += \ - $$PWD/qwaylandxcompositebuffer.cpp diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 9613979bf..554dd40cd 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -1,7 +1,2 @@ TEMPLATE=subdirs -SUBDIRS += platforms - -#The compositor plugins are only useful with QtCompositor -contains(CONFIG, wayland-compositor) { - SUBDIRS += waylandcompositors -} +SUBDIRS += platforms hardwareintegration diff --git a/src/plugins/waylandcompositors/brcm-egl/brcm-egl.pro b/src/plugins/waylandcompositors/brcm-egl/brcm-egl.pro deleted file mode 100644 index 4dcfbaf96..000000000 --- a/src/plugins/waylandcompositors/brcm-egl/brcm-egl.pro +++ /dev/null @@ -1,22 +0,0 @@ -PLUGIN_TYPE = waylandcompositors -load(qt_plugin) - -QT = compositor compositor-private core-private gui-private - -OTHER_FILES += wayland_egl.json - -LIBS += -lEGL - -SOURCES += \ - brcmeglintegration.cpp \ - brcmbuffer.cpp \ - main.cpp - - -HEADERS += \ - brcmeglintegration.h \ - brcmbuffer.h - -OTHER_FILES += brcm-egl.json - -WAYLANDSERVERSOURCES += $$PWD/../../../extensions/brcm.xml $$PWD/../../../3rdparty/protocol/wayland.xml diff --git a/src/plugins/waylandcompositors/brcm-egl/brcmbuffer.cpp b/src/plugins/waylandcompositors/brcm-egl/brcmbuffer.cpp deleted file mode 100644 index e4fbfb553..000000000 --- a/src/plugins/waylandcompositors/brcm-egl/brcmbuffer.cpp +++ /dev/null @@ -1,75 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "brcmbuffer.h" - -#include <EGL/eglext.h> - -#define EGL_EGLEXT_PROTOTYPES -#include <EGL/eglext_brcm.h> - -QT_BEGIN_NAMESPACE - -BrcmBuffer::BrcmBuffer(struct ::wl_client *client, uint32_t id, const QSize &size, EGLint *data, size_t count) - : QtWaylandServer::wl_buffer(client, id) - , m_handle(count) - , m_invertedY(false) - , m_size(size) -{ - for (size_t i = 0; i < count; ++i) - m_handle[i] = data[i]; -} - -BrcmBuffer::~BrcmBuffer() -{ - eglDestroyGlobalImageBRCM(handle()); -} - -void BrcmBuffer::buffer_destroy_resource(Resource *) -{ - delete this; -} - -void BrcmBuffer::buffer_destroy(Resource *resource) -{ - wl_resource_destroy(resource->handle); -} - -QT_END_NAMESPACE diff --git a/src/plugins/waylandcompositors/brcm-egl/brcmbuffer.h b/src/plugins/waylandcompositors/brcm-egl/brcmbuffer.h deleted file mode 100644 index 6ec5868f9..000000000 --- a/src/plugins/waylandcompositors/brcm-egl/brcmbuffer.h +++ /dev/null @@ -1,81 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BRCMBUFFER_H -#define BRCMBUFFER_H - -#include <QtCompositor/private/qwlcompositor_p.h> -#include <qwayland-server-wayland.h> - -#include <QtCore/QSize> -#include <QtCore/QVector> - -#include <EGL/egl.h> - -QT_BEGIN_NAMESPACE - -class BrcmBuffer : public QtWaylandServer::wl_buffer -{ -public: - BrcmBuffer(struct ::wl_client *client, uint32_t id, const QSize &size, EGLint *data, size_t count); - ~BrcmBuffer(); - - bool isYInverted() const { return m_invertedY; } - void setInvertedY(bool inverted) { m_invertedY = inverted; } - - EGLint *handle() { return m_handle.data(); } - - QSize size() { return m_size; } - - static BrcmBuffer *fromResource(struct ::wl_resource *resource) { return static_cast<BrcmBuffer*>(Resource::fromResource(resource)->buffer); } - -protected: - void buffer_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; - void buffer_destroy(Resource *resource) Q_DECL_OVERRIDE; - -private: - QVector<EGLint> m_handle; - bool m_invertedY; - QSize m_size; -}; - -QT_END_NAMESPACE - -#endif // BRCMBUFFER_H diff --git a/src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.cpp b/src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.cpp deleted file mode 100644 index 0ef8318fb..000000000 --- a/src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.cpp +++ /dev/null @@ -1,184 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "brcmeglintegration.h" -#include "brcmbuffer.h" -#include <QtCompositor/private/qwlsurface_p.h> -#include <QtCompositor/private/qwlcompositor_p.h> -#include <QtCompositor/qwaylandsurface.h> -#include <qpa/qplatformnativeinterface.h> -#include <QtGui/QGuiApplication> -#include <QtGui/QOpenGLContext> -#include <qpa/qplatformscreen.h> -#include <QtGui/QWindow> - -#include <EGL/egl.h> -#include <EGL/eglext.h> - -#define EGL_EGLEXT_PROTOTYPES -#include <EGL/eglext_brcm.h> - -#include <GLES2/gl2.h> -#include <GLES2/gl2ext.h> - -QT_BEGIN_NAMESPACE - -class BrcmEglIntegrationPrivate -{ -public: - BrcmEglIntegrationPrivate() - : egl_display(EGL_NO_DISPLAY) - , valid(false) - { } - EGLDisplay egl_display; - bool valid; - PFNEGLQUERYGLOBALIMAGEBRCMPROC eglQueryGlobalImageBRCM; - PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES; - PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR; - PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR; -}; - -BrcmEglIntegration::BrcmEglIntegration() - : QWaylandGraphicsHardwareIntegration() - , QtWaylandServer::qt_brcm() - , d_ptr(new BrcmEglIntegrationPrivate) -{ -} - -void BrcmEglIntegration::initializeHardware(QtWayland::Display *waylandDisplay) -{ - Q_D(BrcmEglIntegration); - - QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); - if (nativeInterface) { - d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay"); - if (!d->egl_display) - qWarning("Failed to acquire EGL display from platform integration"); - - d->eglQueryGlobalImageBRCM = eglQueryGlobalImageBRCM; - - if (!d->eglQueryGlobalImageBRCM) { - qWarning("Failed to resolve eglQueryGlobalImageBRCM"); - return; - } - - d->glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES"); - - if (!d->glEGLImageTargetTexture2DOES) { - qWarning("Failed to resolve glEGLImageTargetTexture2DOES"); - return; - } - - d->eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR"); - - if (!d->eglCreateImageKHR) { - qWarning("Failed to resolve eglCreateImageKHR"); - return; - } - - d->eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress("eglDestroyImageKHR"); - - if (!d->eglDestroyImageKHR) { - qWarning("Failed to resolve eglDestroyImageKHR"); - return; - } - d->valid = true; - init(waylandDisplay->handle()); - } -} - -GLuint BrcmEglIntegration::createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *) -{ - Q_D(BrcmEglIntegration); - if (!d->valid) { - qWarning("createTextureFromBuffer() failed\n"); - return 0; - } - - BrcmBuffer *brcmBuffer = BrcmBuffer::fromResource(buffer); - - if (!d->eglQueryGlobalImageBRCM(brcmBuffer->handle(), brcmBuffer->handle() + 2)) { - qWarning("eglQueryGlobalImageBRCM failed!"); - return 0; - } - - EGLImageKHR image = d->eglCreateImageKHR(d->egl_display, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)brcmBuffer->handle(), NULL); - if (image == EGL_NO_IMAGE_KHR) - qWarning("eglCreateImageKHR() failed: %x\n", eglGetError()); - - GLuint textureId; - glGenTextures(1, &textureId); - - glBindTexture(GL_TEXTURE_2D, textureId); - - d->glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image); - - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - d->eglDestroyImageKHR(d->egl_display, image); - - return textureId; -} - -bool BrcmEglIntegration::isYInverted(struct ::wl_resource *) const -{ - return false; -} - -void BrcmEglIntegration::brcm_bind_resource(Resource *) -{ -} - -void BrcmEglIntegration::brcm_create_buffer(Resource *resource, uint32_t id, int32_t width, int32_t height, wl_array *data) -{ - new BrcmBuffer(resource->client(), id, QSize(width, height), static_cast<EGLint *>(data->data), data->size / sizeof(EGLint)); -} - -QSize BrcmEglIntegration::bufferSize(struct ::wl_resource *buffer) const -{ - BrcmBuffer *brcmBuffer = BrcmBuffer::fromResource(buffer); - - return brcmBuffer->size(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.h b/src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.h deleted file mode 100644 index 229905612..000000000 --- a/src/plugins/waylandcompositors/brcm-egl/brcmeglintegration.h +++ /dev/null @@ -1,78 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BRCMEGLINTEGRATION_H -#define BRCMEGLINTEGRATION_H - -#include <QtCompositor/qwaylandgraphicshardwareintegration.h> -#include "qwayland-server-brcm.h" - -#include <QtCore/QScopedPointer> - -QT_BEGIN_NAMESPACE - -class BrcmEglIntegrationPrivate; - -class BrcmEglIntegration : public QWaylandGraphicsHardwareIntegration, public QtWaylandServer::qt_brcm -{ - Q_DECLARE_PRIVATE(BrcmEglIntegration) -public: - BrcmEglIntegration(); - - void initializeHardware(QtWayland::Display *waylandDisplay) Q_DECL_OVERRIDE; - - GLuint createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *context) Q_DECL_OVERRIDE; - bool isYInverted(struct ::wl_resource *) const Q_DECL_OVERRIDE; - - QSize bufferSize(struct ::wl_resource *buffer) const Q_DECL_OVERRIDE; - -protected: - void brcm_bind_resource(Resource *resource) Q_DECL_OVERRIDE; - void brcm_create_buffer(Resource *resource, uint32_t id, int32_t width, int32_t height, wl_array *data) Q_DECL_OVERRIDE; - -private: - Q_DISABLE_COPY(BrcmEglIntegration) - QScopedPointer<BrcmEglIntegrationPrivate> d_ptr; -}; - -QT_END_NAMESPACE - -#endif // BRCMEGLINTEGRATION_H - diff --git a/src/plugins/waylandcompositors/wayland-egl/wayland-egl.pro b/src/plugins/waylandcompositors/wayland-egl/wayland-egl.pro deleted file mode 100644 index 730956398..000000000 --- a/src/plugins/waylandcompositors/wayland-egl/wayland-egl.pro +++ /dev/null @@ -1,22 +0,0 @@ -PLUGIN_TYPE = waylandcompositors -load(qt_plugin) - -QT = compositor compositor-private core-private gui-private - -OTHER_FILES += wayland-egl.json - -WAYLANDSERVERSOURCES += $$PWD/../../../3rdparty/protocol/wayland.xml - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += wayland-egl egl -} else { - LIBS += -lwayland-egl -lEGL -} - -SOURCES += \ - waylandeglintegration.cpp \ - main.cpp - -HEADERS += \ - waylandeglintegration.h diff --git a/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.cpp b/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.cpp deleted file mode 100644 index abf12fad4..000000000 --- a/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.cpp +++ /dev/null @@ -1,276 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "waylandeglintegration.h" - -#include <QtCompositor/private/qwlcompositor_p.h> -#include <QtCompositor/private/qwlsurface_p.h> -#include <qpa/qplatformnativeinterface.h> -#include <QtGui/QGuiApplication> -#include <QtGui/QOpenGLContext> -#include <qpa/qplatformscreen.h> -#include <QtGui/QWindow> -#include <QtCore/QPointer> - -#include <QDebug> - -#include <EGL/egl.h> -#include <EGL/eglext.h> - -#include <GLES2/gl2.h> -#include <GLES2/gl2ext.h> - -#ifndef EGL_WL_bind_wayland_display -typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL) (EGLDisplay dpy, struct wl_buffer *buffer, EGLint attribute, EGLint *value); -#endif - -#ifndef EGL_KHR_image -typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); -#endif - -#ifndef GL_OES_EGL_image -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); -#endif - -QT_BEGIN_NAMESPACE - -class WaylandEglIntegrationPrivate -{ -public: - WaylandEglIntegrationPrivate() - : egl_display(EGL_NO_DISPLAY) - , valid(false) - , display_bound(false) - , flipperConnected(false) - , egl_bind_wayland_display(0) - , egl_unbind_wayland_display(0) - , egl_query_wayland_buffer(0) - , egl_create_image(0) - , egl_destroy_image(0) - , gl_egl_image_target_texture_2d(0) - { } - EGLDisplay egl_display; - bool valid; - bool display_bound; - bool flipperConnected; -#ifdef EGL_WL_request_client_buffer_format - QPointer<WaylandSurface> directRenderSurface; -#endif - PFNEGLBINDWAYLANDDISPLAYWL egl_bind_wayland_display; - PFNEGLUNBINDWAYLANDDISPLAYWL egl_unbind_wayland_display; - PFNEGLQUERYWAYLANDBUFFERWL egl_query_wayland_buffer; - - PFNEGLCREATEIMAGEKHRPROC egl_create_image; - PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image; - - PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gl_egl_image_target_texture_2d; -}; - -WaylandEglIntegration::WaylandEglIntegration() - : QWaylandGraphicsHardwareIntegration() - , d_ptr(new WaylandEglIntegrationPrivate) -{ -} - -void WaylandEglIntegration::initializeHardware(QtWayland::Display *waylandDisplay) -{ - Q_D(WaylandEglIntegration); - - const bool ignoreBindDisplay = !qgetenv("QT_WAYLAND_IGNORE_BIND_DISPLAY").isEmpty(); - - QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); - if (!nativeInterface) { - qWarning("Failed to initialize egl display. No native platform interface available.\n"); - return; - } - - d->egl_display = nativeInterface->nativeResourceForWindow("EglDisplay", m_compositor->window()); - if (!d->egl_display) { - qWarning("Failed to initialize egl display. Could not get EglDisplay for window.\n"); - return; - } - - const char *extensionString = eglQueryString(d->egl_display, EGL_EXTENSIONS); - if ((!extensionString || !strstr(extensionString, "EGL_WL_bind_wayland_display")) && !ignoreBindDisplay) { - qWarning("Failed to initialize egl display. There is no EGL_WL_bind_wayland_display extension.\n"); - return; - } - - d->egl_bind_wayland_display = reinterpret_cast<PFNEGLBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglBindWaylandDisplayWL")); - d->egl_unbind_wayland_display = reinterpret_cast<PFNEGLUNBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglUnbindWaylandDisplayWL")); - if (!d->egl_bind_wayland_display || !d->egl_unbind_wayland_display && !ignoreBindDisplay) { - qWarning("Failed to initialize egl display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL.\n"); - return; - } - - d->egl_query_wayland_buffer = reinterpret_cast<PFNEGLQUERYWAYLANDBUFFERWL>(eglGetProcAddress("eglQueryWaylandBufferWL")); - if (!d->egl_query_wayland_buffer) { - qWarning("Failed to initialize egl display. Could not find eglQueryWaylandBufferWL.\n"); - return; - } - - d->egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR")); - d->egl_destroy_image = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR")); - if (!d->egl_create_image || !d->egl_destroy_image) { - qWarning("Failed to initialize egl display. Could not find eglCreateImageKHR and eglDestroyImageKHR.\n"); - return; - } - - d->gl_egl_image_target_texture_2d = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES")); - if (!d->gl_egl_image_target_texture_2d) { - qWarning("Failed to initialize egl display. Could not find glEGLImageTargetTexture2DOES.\n"); - return; - } - - if (d->egl_bind_wayland_display && d->egl_unbind_wayland_display) { - d->display_bound = d->egl_bind_wayland_display(d->egl_display, waylandDisplay->handle()); - if (!d->display_bound || ignoreBindDisplay) { - qWarning("Failed to initialize egl display. Could not bind Wayland display.\n"); - return; - } - } - - d->valid = true; - - qWarning("EGL Wayland extension successfully initialized.%s\n", !d->display_bound ? " eglBindWaylandDisplayWL ignored" : ""); -} - -GLuint WaylandEglIntegration::createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *) -{ - Q_D(WaylandEglIntegration); - if (!d->valid) { - qWarning("createTextureFromBuffer() failed\n"); - return 0; - } - - EGLImageKHR image = d->egl_create_image(d->egl_display, EGL_NO_CONTEXT, - EGL_WAYLAND_BUFFER_WL, - buffer, NULL); - - GLuint textureId; - glGenTextures(1,&textureId); - - glBindTexture(GL_TEXTURE_2D, textureId); - - d->gl_egl_image_target_texture_2d(GL_TEXTURE_2D, image); - - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - d->egl_destroy_image(d->egl_display, image); - - return textureId; -} - -bool WaylandEglIntegration::isYInverted(struct ::wl_resource *buffer) const -{ -#ifdef EGL_WL_request_client_buffer_format - return eglGetBufferYInvertedWL(buffer); -#else - return QWaylandGraphicsHardwareIntegration::isYInverted(buffer); -#endif -} - - -bool WaylandEglIntegration::setDirectRenderSurface(QWaylandSurface *surface) -{ - Q_D(WaylandEglIntegration); - - QPlatformScreen *screen = QPlatformScreen::platformScreenForWindow(m_compositor->window()); - QPlatformScreenPageFlipper *flipper = screen ? screen->pageFlipper() : 0; - if (flipper && !d->flipperConnected) { - QObject::connect(flipper, SIGNAL(bufferReleased(QPlatformScreenBuffer*)), m_compositor->handle(), SLOT(releaseBuffer(QPlatformScreenBuffer*))); - d->flipperConnected = true; - } -#ifdef EGL_WL_request_client_buffer_format - int buffer_format = surface ? EGL_SCANOUT_FORMAT_WL : EGL_RENDER_FORMAT_WL; - struct wl_client *client = 0; - if (surface) { - client = surface->handle()->base()->resource.client; - } else { - WaylandSurface *oldSurface = d->directRenderSurface.data(); - if (oldSurface) - client = oldSurface->handle()->base()->resource.client; - } - if (client) - eglRequestClientBufferFormatWL(d->egl_display, client, buffer_format); - d->directRenderSurface = surface; -#else - Q_UNUSED(surface); -#endif - return flipper; -} - -void *WaylandEglIntegration::lockNativeBuffer(struct ::wl_resource *buffer, QOpenGLContext *) const -{ - Q_D(const WaylandEglIntegration); - - EGLImageKHR image = d->egl_create_image(d->egl_display, EGL_NO_CONTEXT, - EGL_WAYLAND_BUFFER_WL, - buffer, NULL); - return image; -} - -void WaylandEglIntegration::unlockNativeBuffer(void *native_buffer, QOpenGLContext *) const -{ - Q_D(const WaylandEglIntegration); - EGLImageKHR image = static_cast<EGLImageKHR>(native_buffer); - - d->egl_destroy_image(d->egl_display, image); -} - -QSize WaylandEglIntegration::bufferSize(struct ::wl_resource *buffer) const -{ - Q_D(const WaylandEglIntegration); - - int width, height; - d->egl_query_wayland_buffer(d->egl_display, reinterpret_cast<struct ::wl_buffer *>(buffer), EGL_WIDTH, &width); - d->egl_query_wayland_buffer(d->egl_display, reinterpret_cast<struct ::wl_buffer *>(buffer), EGL_HEIGHT, &height); - - return QSize(width, height); -} - -QT_END_NAMESPACE diff --git a/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.h b/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.h deleted file mode 100644 index ce3284291..000000000 --- a/src/plugins/waylandcompositors/wayland-egl/waylandeglintegration.h +++ /dev/null @@ -1,77 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef WAYLANDEGLINTEGRATION_H -#define WAYLANDEGLINTEGRATION_H - -#include <QtCompositor/qwaylandgraphicshardwareintegration.h> -#include <QtCore/QScopedPointer> - -QT_BEGIN_NAMESPACE - -class WaylandEglIntegrationPrivate; - -class WaylandEglIntegration : public QWaylandGraphicsHardwareIntegration -{ - Q_DECLARE_PRIVATE(WaylandEglIntegration) -public: - WaylandEglIntegration(); - - void initializeHardware(QtWayland::Display *waylandDisplay) Q_DECL_OVERRIDE; - - GLuint createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *context) Q_DECL_OVERRIDE; - bool isYInverted(struct ::wl_resource *) const Q_DECL_OVERRIDE; - - bool setDirectRenderSurface(QWaylandSurface *) Q_DECL_OVERRIDE; - - void *lockNativeBuffer(struct ::wl_resource *buffer, QOpenGLContext *context) const Q_DECL_OVERRIDE; - void unlockNativeBuffer(void *native_buffer, QOpenGLContext *context) const Q_DECL_OVERRIDE; - - QSize bufferSize(struct ::wl_resource *buffer) const Q_DECL_OVERRIDE; - -private: - Q_DISABLE_COPY(WaylandEglIntegration) - QScopedPointer<WaylandEglIntegrationPrivate> d_ptr; -}; - -QT_END_NAMESPACE - -#endif // WAYLANDEGLINTEGRATION_H - diff --git a/src/plugins/waylandcompositors/waylandcompositors.pro b/src/plugins/waylandcompositors/waylandcompositors.pro deleted file mode 100644 index 8a4d9b04a..000000000 --- a/src/plugins/waylandcompositors/waylandcompositors.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = subdirs - -!isEqual(QT_WAYLAND_GL_CONFIG,nogl) { - config_wayland_egl { - SUBDIRS += wayland-egl - } - config_brcm_egl { - SUBDIRS += brcm-egl - } - config_xcomposite { - config_egl { - SUBDIRS += xcomposite-egl - } else:config_glx { - SUBDIRS += xcomposite-glx - } - } -} diff --git a/src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.pro b/src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.pro deleted file mode 100644 index d463e6e83..000000000 --- a/src/plugins/waylandcompositors/xcomposite-egl/xcomposite-egl.pro +++ /dev/null @@ -1,22 +0,0 @@ -PLUGIN_TYPE = waylandcompositors -load(qt_plugin) - -QT = compositor compositor-private core-private gui-private - -OTHER_FILES += xcomposite-egl.json - -include (../xcomposite_share/xcomposite_share.pri) - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += xcomposite egl x11 -} else { - LIBS += -lXcomposite -lEGL -lX11 -} - -HEADERS += \ - xcompositeeglintegration.h - -SOURCES += \ - xcompositeeglintegration.cpp \ - main.cpp diff --git a/src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.cpp b/src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.cpp deleted file mode 100644 index b80858b2c..000000000 --- a/src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.cpp +++ /dev/null @@ -1,150 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "xcompositeeglintegration.h" - -#include "wayland-xcomposite-server-protocol.h" - -#include <QtCompositor/private/qwlcompositor_p.h> -#include <QtGui/QGuiApplication> -#include <qpa/qplatformnativeinterface.h> -#include <qpa/qplatformopenglcontext.h> - -#include "xcompositebuffer.h" -#include "xcompositehandler.h" -#include <X11/extensions/Xcomposite.h> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -QVector<EGLint> eglbuildSpec() -{ - QVector<EGLint> spec; - - spec.append(EGL_SURFACE_TYPE); spec.append(EGL_WINDOW_BIT | EGL_PIXMAP_BIT); - spec.append(EGL_RENDERABLE_TYPE); spec.append(EGL_OPENGL_ES2_BIT); - spec.append(EGL_BIND_TO_TEXTURE_RGBA); spec.append(EGL_TRUE); - spec.append(EGL_ALPHA_SIZE); spec.append(8); - spec.append(EGL_NONE); - return spec; -} - -XCompositeEglIntegration::XCompositeEglIntegration() - : QWaylandGraphicsHardwareIntegration() - , mDisplay(0) -{ - -} - -void XCompositeEglIntegration::initializeHardware(QtWayland::Display *) -{ - QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); - if (nativeInterface) { - mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWindow("Display",m_compositor->window())); - if (!mDisplay) - qFatal("could not retireve Display from platform integration"); - mEglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForWindow("EGLDisplay",m_compositor->window())); - if (!mEglDisplay) - qFatal("could not retrieve EGLDisplay from platform integration"); - } else { - qFatal("Platform integration doesn't have native interface"); - } - mScreen = XDefaultScreen(mDisplay); - new XCompositeHandler(m_compositor->handle(), mDisplay); -} - -GLuint XCompositeEglIntegration::createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *) -{ - XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(buffer); - Pixmap pixmap = XCompositeNameWindowPixmap(mDisplay, compositorBuffer->window()); - - QVector<EGLint> eglConfigSpec = eglbuildSpec(); - - EGLint matching = 0; - EGLConfig config; - bool matched = eglChooseConfig(mEglDisplay,eglConfigSpec.constData(),&config,1,&matching); - if (!matched || !matching) { - qWarning("Could not retrieve a suitable EGL config"); - return 0; - } - - QVector<EGLint> attribList; - - attribList.append(EGL_TEXTURE_FORMAT); - attribList.append(EGL_TEXTURE_RGBA); - attribList.append(EGL_TEXTURE_TARGET); - attribList.append(EGL_TEXTURE_2D); - attribList.append(EGL_NONE); - - EGLSurface surface = eglCreatePixmapSurface(mEglDisplay,config,pixmap,attribList.constData()); - if (surface == EGL_NO_SURFACE) { - qDebug() << "Failed to create eglsurface" << pixmap << compositorBuffer->window(); - } - - compositorBuffer->setInvertedY(true); - - GLuint textureId; - glGenTextures(1,&textureId); - glBindTexture(GL_TEXTURE_2D, textureId); - - if (!eglBindTexImage(mEglDisplay,surface,EGL_BACK_BUFFER)) { - qDebug() << "Failed to bind"; - } - - // eglDestroySurface(mEglDisplay,surface); - - return textureId; -} - -bool XCompositeEglIntegration::isYInverted(struct ::wl_resource *buffer) const -{ - XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(buffer); - return compositorBuffer->isYInverted(); -} - -QSize XCompositeEglIntegration::bufferSize(struct ::wl_resource *buffer) const -{ - XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(buffer); - - return compositorBuffer->size(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.h b/src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.h deleted file mode 100644 index 562fce140..000000000 --- a/src/plugins/waylandcompositors/xcomposite-egl/xcompositeeglintegration.h +++ /dev/null @@ -1,72 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef XCOMPOSITEEGLINTEGRATION_H -#define XCOMPOSITEEGLINTEGRATION_H - -#include <QtCompositor/qwaylandgraphicshardwareintegration.h> - -#include "xlibinclude.h" - -#include <EGL/egl.h> - -QT_BEGIN_NAMESPACE - -class XCompositeEglIntegration : public QWaylandGraphicsHardwareIntegration -{ -public: - XCompositeEglIntegration(); - - void initializeHardware(QtWayland::Display *waylandDisplay) Q_DECL_OVERRIDE; - - GLuint createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *context) Q_DECL_OVERRIDE; - bool isYInverted(struct ::wl_resource *) const Q_DECL_OVERRIDE; - - QSize bufferSize(struct ::wl_resource *buffer) const Q_DECL_OVERRIDE; - -private: - Display *mDisplay; - EGLDisplay mEglDisplay; - int mScreen; -}; - -QT_END_NAMESPACE - -#endif // XCOMPOSITEEGLINTEGRATION_H diff --git a/src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.pro b/src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.pro deleted file mode 100644 index dc2d70dee..000000000 --- a/src/plugins/waylandcompositors/xcomposite-glx/xcomposite-glx.pro +++ /dev/null @@ -1,22 +0,0 @@ -PLUGIN_TYPE = waylandcompositors -load(qt_plugin) - -QT = compositor compositor-private core-private gui-private - -OTHER_FILES += xcomposite-glx.json - -include (../xcomposite_share/xcomposite_share.pri) - -!contains(QT_CONFIG, no-pkg-config) { - CONFIG += link_pkgconfig - PKGCONFIG += xcomposite gl x11 -} else { - LIBS += -lXcomposite -lGL -lX11 -} - -HEADERS += \ - xcompositeglxintegration.h - -SOURCES += \ - xcompositeglxintegration.cpp \ - main.cpp diff --git a/src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.cpp b/src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.cpp deleted file mode 100644 index 421e5df1a..000000000 --- a/src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.cpp +++ /dev/null @@ -1,160 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "xcompositeglxintegration.h" - -#include <QtCompositor/private/qwlcompositor_p.h> -#include "wayland-xcomposite-server-protocol.h" - -#include <qpa/qplatformnativeinterface.h> -#include <qpa/qplatformintegration.h> -#include <QtGui/QOpenGLContext> - -#include "xcompositebuffer.h" -#include "xcompositehandler.h" -#include <X11/extensions/Xcomposite.h> - -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -QVector<int> qglx_buildSpec() -{ - QVector<int> spec(48); - int i = 0; - - spec[i++] = GLX_LEVEL; - spec[i++] = 0; - spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_PIXMAP_BIT | GLX_WINDOW_BIT; - spec[i++] = GLX_BIND_TO_TEXTURE_TARGETS_EXT; spec[i++] = GLX_TEXTURE_2D_BIT_EXT; - spec[i++] = GLX_BIND_TO_TEXTURE_RGB_EXT; spec[i++] = true; - - spec[i++] = 0; - return spec; -} - - -XCompositeGLXIntegration::XCompositeGLXIntegration() - : QWaylandGraphicsHardwareIntegration() - , mDisplay(0) - , mHandler(0) -{ -} - -XCompositeGLXIntegration::~XCompositeGLXIntegration() -{ - delete mHandler; -} - -void XCompositeGLXIntegration::initializeHardware(QtWayland::Display *) -{ - QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface(); - if (nativeInterface) { - mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWindow("Display",m_compositor->window())); - if (!mDisplay) - qFatal("could not retireve Display from platform integration"); - } else { - qFatal("Platform integration doesn't have native interface"); - } - mScreen = XDefaultScreen(mDisplay); - - mHandler = new XCompositeHandler(m_compositor->handle(), mDisplay); - - QOpenGLContext *glContext = new QOpenGLContext(); - glContext->create(); - - m_glxBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT")); - if (!m_glxBindTexImageEXT) { - qDebug() << "Did not find glxBindTexImageExt, everything will FAIL!"; - } - m_glxReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT")); - if (!m_glxReleaseTexImageEXT) { - qDebug() << "Did not find glxReleaseTexImageExt"; - } - - delete glContext; -} - -GLuint XCompositeGLXIntegration::createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *) -{ - XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(buffer); - Pixmap pixmap = XCompositeNameWindowPixmap(mDisplay, compositorBuffer->window()); - - QVector<int> glxConfigSpec = qglx_buildSpec(); - int numberOfConfigs; - GLXFBConfig *configs = glXChooseFBConfig(mDisplay,mScreen,glxConfigSpec.constData(),&numberOfConfigs); - - QVector<int> attribList; - attribList.append(GLX_TEXTURE_FORMAT_EXT); - attribList.append(GLX_TEXTURE_FORMAT_RGB_EXT); - attribList.append(GLX_TEXTURE_TARGET_EXT); - attribList.append(GLX_TEXTURE_2D_EXT); - attribList.append(0); - GLXPixmap glxPixmap = glXCreatePixmap(mDisplay,*configs,pixmap,attribList.constData()); - - uint inverted = 0; - glXQueryDrawable(mDisplay, glxPixmap, GLX_Y_INVERTED_EXT,&inverted); - compositorBuffer->setInvertedY(!inverted); - - XFree(configs); - - GLuint textureId; - glGenTextures(1,&textureId); - glBindTexture(GL_TEXTURE_2D, textureId); - m_glxBindTexImageEXT(mDisplay,glxPixmap,GLX_FRONT_EXT, 0); - //Do we need to change the api so that we do bind and release in the painevent? - //The specification states that when deleting the texture the color buffer is deleted -// m_glxReleaseTexImageEXT(mDisplay,glxPixmap,GLX_FRONT_EXT); - return textureId; -} - -bool XCompositeGLXIntegration::isYInverted(struct ::wl_resource *buffer) const -{ - return XCompositeBuffer::fromResource(buffer)->isYInverted(); -} - -QSize XCompositeGLXIntegration::bufferSize(struct ::wl_resource *buffer) const -{ - XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(buffer); - - return compositorBuffer->size(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.h b/src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.h deleted file mode 100644 index 11146ef23..000000000 --- a/src/plugins/waylandcompositors/xcomposite-glx/xcompositeglxintegration.h +++ /dev/null @@ -1,80 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef XCOMPOSITEGLXINTEGRATION_H -#define XCOMPOSITEGLXINTEGRATION_H - -#include <QtCompositor/qwaylandgraphicshardwareintegration.h> - -#include "xlibinclude.h" - -#define GLX_GLXEXT_PROTOTYPES -#include <GL/glx.h> -#include <GL/glxext.h> - -QT_BEGIN_NAMESPACE - -class XCompositeHandler; - -class XCompositeGLXIntegration : public QWaylandGraphicsHardwareIntegration -{ -public: - XCompositeGLXIntegration(); - ~XCompositeGLXIntegration(); - - void initializeHardware(QtWayland::Display *waylandDisplay) Q_DECL_OVERRIDE; - - GLuint createTextureFromBuffer(struct ::wl_resource *buffer, QOpenGLContext *context) Q_DECL_OVERRIDE; - bool isYInverted(struct ::wl_resource *) const Q_DECL_OVERRIDE; - - QSize bufferSize(struct ::wl_resource *buffer) const Q_DECL_OVERRIDE; - -private: - PFNGLXBINDTEXIMAGEEXTPROC m_glxBindTexImageEXT; - PFNGLXRELEASETEXIMAGEEXTPROC m_glxReleaseTexImageEXT; - - Display *mDisplay; - int mScreen; - XCompositeHandler *mHandler; -}; - -QT_END_NAMESPACE - -#endif // XCOMPOSITEGLXINTEGRATION_H diff --git a/src/plugins/waylandcompositors/xcomposite_share/xcomposite_share.pri b/src/plugins/waylandcompositors/xcomposite_share/xcomposite_share.pri deleted file mode 100644 index 7e0bc4579..000000000 --- a/src/plugins/waylandcompositors/xcomposite_share/xcomposite_share.pri +++ /dev/null @@ -1,14 +0,0 @@ -INCLUDEPATH += $$PWD - -WAYLANDSERVERSOURCES += $$PWD/../../../extensions/xcomposite.xml $$PWD/../../../3rdparty/protocol/wayland.xml - -HEADERS += \ - $$PWD/xcompositebuffer.h \ - $$PWD/xcompositehandler.h \ - $$PWD/xlibinclude.h - -SOURCES += \ - $$PWD/xcompositebuffer.cpp \ - $$PWD/xcompositehandler.cpp - -QT += gui-private diff --git a/src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.cpp b/src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.cpp deleted file mode 100644 index 0457214b4..000000000 --- a/src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.cpp +++ /dev/null @@ -1,69 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "xcompositebuffer.h" - -QT_BEGIN_NAMESPACE - -XCompositeBuffer::XCompositeBuffer(Window window, const QSize &size, - struct ::wl_client *client, uint32_t id) - : QtWaylandServer::wl_buffer(client, id) - , mWindow(window) - , mInvertedY(false) - , mSize(size) -{ -} - -void XCompositeBuffer::buffer_destroy_resource(Resource *) -{ - delete this; -} - -void XCompositeBuffer::buffer_destroy(Resource *resource) -{ - wl_resource_destroy(resource->handle); -} - -Window XCompositeBuffer::window() -{ - return mWindow; -} - -QT_END_NAMESPACE diff --git a/src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.h b/src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.h deleted file mode 100644 index 20cf399b6..000000000 --- a/src/plugins/waylandcompositors/xcomposite_share/xcompositebuffer.h +++ /dev/null @@ -1,85 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef XCOMPOSITEBUFFER_H -#define XCOMPOSITEBUFFER_H - -#include <private/qwlcompositor_p.h> -#include <qwayland-server-wayland.h> - -#include <QtCore/QSize> - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> - -#include <X11/X.h> - -QT_BEGIN_NAMESPACE - -class XCompositeBuffer : public QtWaylandServer::wl_buffer -{ -public: - XCompositeBuffer(Window window, const QSize &size, - struct ::wl_client *client, uint32_t id); - - Window window(); - - bool isYInverted() const { return mInvertedY; } - void setInvertedY(bool inverted) { mInvertedY = inverted; } - - QSize size() const { return mSize; } - - static XCompositeBuffer *fromResource(struct ::wl_resource *resource) { return static_cast<XCompositeBuffer*>(Resource::fromResource(resource)->buffer); } - -protected: - void buffer_destroy_resource(Resource *) Q_DECL_OVERRIDE; - void buffer_destroy(Resource *) Q_DECL_OVERRIDE; - -private: - Window mWindow; - bool mInvertedY; - QSize mSize; -}; - -QT_END_NAMESPACE - -#endif // XCOMPOSITORBUFFER_H diff --git a/src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.cpp b/src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.cpp deleted file mode 100644 index 0f10d38de..000000000 --- a/src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.cpp +++ /dev/null @@ -1,78 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "xcompositehandler.h" - -#include "wayland-xcomposite-server-protocol.h" - -#include "xcompositebuffer.h" -#include <X11/extensions/Xcomposite.h> - -QT_BEGIN_NAMESPACE - -XCompositeHandler::XCompositeHandler(QtWayland::Compositor *compositor, Display *display) - : QtWaylandServer::qt_xcomposite(compositor->wl_display()) -{ - compositor->window()->create(); - - mFakeRootWindow = new QWindow(compositor->window()); - mFakeRootWindow->setGeometry(QRect(-1,-1,1,1)); - mFakeRootWindow->create(); - mFakeRootWindow->show(); - - int composite_event_base, composite_error_base; - if (!XCompositeQueryExtension(display, &composite_event_base, &composite_error_base)) - qFatal("XComposite required"); - - mDisplayString = QString::fromLocal8Bit(XDisplayString(display)); -} - -void XCompositeHandler::xcomposite_bind_resource(Resource *resource) -{ - send_root(resource->handle, mDisplayString, mFakeRootWindow->winId()); -} - -void XCompositeHandler::xcomposite_create_buffer(Resource *resource, uint32_t id, uint32_t window, - int32_t width, int32_t height) -{ - new XCompositeBuffer(Window(window), QSize(width, height), resource->client(), id); -} - -QT_END_NAMESPACE diff --git a/src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.h b/src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.h deleted file mode 100644 index 678ad4460..000000000 --- a/src/plugins/waylandcompositors/xcomposite_share/xcompositehandler.h +++ /dev/null @@ -1,71 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef XCOMPOSITEHANDLER_H -#define XCOMPOSITEHANDLER_H - -#include <QtCompositor/private/qwlcompositor_p.h> - -#include "xlibinclude.h" - -#include "qwayland-server-xcomposite.h" -#include <wayland-server.h> - -QT_BEGIN_NAMESPACE - -class XCompositeHandler : public QtWaylandServer::qt_xcomposite -{ -public: - XCompositeHandler(QtWayland::Compositor *compositor, Display *display); - -private: - QWindow *mFakeRootWindow; - - QString mDisplayString; - - void xcomposite_bind_resource(Resource *resource) Q_DECL_OVERRIDE; - void xcomposite_create_buffer(Resource *resource, uint32_t id, uint32_t x_window, - int32_t width, int32_t height) Q_DECL_OVERRIDE; - -}; - -QT_END_NAMESPACE - -#endif // XCOMPOSITEHANDLER_H diff --git a/src/plugins/waylandcompositors/xcomposite_share/xlibinclude.h b/src/plugins/waylandcompositors/xcomposite_share/xlibinclude.h deleted file mode 100644 index 733fd6fd0..000000000 --- a/src/plugins/waylandcompositors/xcomposite_share/xlibinclude.h +++ /dev/null @@ -1,78 +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 Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef XLIBINCLUDE_H -#define XLIBINCLUDE_H - -#include <QtCore/QEvent> -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> -#include <QtGui/QCursor> -#include <QtGui/private/qguiapplication_p.h> - -#include <X11/Xlib.h> -#include "X11/extensions/Xcomposite.h" - -enum { - XFocusOut = FocusOut, - XFocusIn = FocusIn, - XKeyPress = KeyPress, - XKeyRelease = KeyRelease, - XNone = None, - XRevertToParent = RevertToParent, - XGrayScale = GrayScale, - XCursorShape = CursorShape -}; -#undef FocusOut -#undef FocusIn -#undef KeyPress -#undef KeyRelease -#undef None -#undef RevertToParent -#undef GrayScale -#undef CursorShape - -#ifdef FontChange -#undef FontChange -#endif - -#endif //XLIBINCLUDE_H |