Client: Move xdg-shell-v6 to a plugin

[ChangeLog][QPA plugin] The xdg-shell-v6 shell integration has been
moved to a plugin.

Change-Id: I548d19590ddbc8ad3e791301359a6de17ac9dcd8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2018-05-24 12:12:53 +02:00 committed by Johan Helsing
parent 4183147e80
commit 390856f452
10 changed files with 116 additions and 45 deletions

View File

@ -28,7 +28,6 @@ WAYLANDCLIENTSOURCES += \
../extensions/qt-key-unstable-v1.xml \
../extensions/qt-windowmanager.xml \
../3rdparty/protocol/text-input-unstable-v2.xml \
../3rdparty/protocol/xdg-shell-unstable-v6.xml \
WAYLANDCLIENTSOURCES_SYSTEM += \
../3rdparty/protocol/wayland.xml \
@ -42,8 +41,6 @@ SOURCES += qwaylandintegration.cpp \
qwaylandscreen.cpp \
qwaylandshmwindow.cpp \
qwaylandshellsurface.cpp \
qwaylandxdgshellv6.cpp \
qwaylandxdgshellv6integration.cpp \
qwaylandextendedsurface.cpp \
qwaylandsubsurface.cpp \
qwaylandtouch.cpp \
@ -69,8 +66,6 @@ HEADERS += qwaylandintegration_p.h \
qwaylandbuffer_p.h \
qwaylandshmwindow_p.h \
qwaylandshellsurface_p.h \
qwaylandxdgshellv6_p.h \
qwaylandxdgshellv6integration_p.h \
qwaylandextendedsurface_p.h \
qwaylandsubsurface_p.h \
qwaylandtouch_p.h \

View File

@ -3,5 +3,6 @@ TEMPLATE = subdirs
SUBDIRS += \
ivi-shell \
xdg-shell-v5 \
xdg-shell-v6 \
wl-shell \

View File

@ -0,0 +1,68 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qwaylandxdgshellv6integration_p.h"
#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
class QWaylandXdgShellV6IntegrationPlugin : public QWaylandShellIntegrationPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "xdg-shell-v6.json")
public:
QWaylandShellIntegration *create(const QString &key, const QStringList &paramList) override;
};
QWaylandShellIntegration *QWaylandXdgShellV6IntegrationPlugin::create(const QString &key, const QStringList &paramList)
{
Q_UNUSED(key);
Q_UNUSED(paramList);
return new QWaylandXdgShellV6Integration();
}
}
QT_END_NAMESPACE
#include "main.moc"

View File

@ -40,11 +40,11 @@
#include "qwaylandxdgshellv6_p.h"
#include "qwaylanddisplay_p.h"
#include "qwaylandwindow_p.h"
#include "qwaylandinputdevice_p.h"
#include "qwaylandscreen_p.h"
#include "qwaylandabstractdecoration_p.h"
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
#include <QtWaylandClient/private/qwaylandscreen_p.h>
#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
QT_BEGIN_NAMESPACE

View File

@ -52,15 +52,16 @@
// We mean it.
//
#include "qwayland-xdg-shell-unstable-v6.h"
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
#include <QtCore/QSize>
#include <QtGui/QRegion>
#include <wayland-client.h>
#include <QtWaylandClient/private/qwayland-xdg-shell-unstable-v6.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include "qwaylandshellsurface_p.h"
QT_BEGIN_NAMESPACE
class QWindow;

View File

@ -41,39 +41,26 @@
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandxdgshellv6_p.h>
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *display)
bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display)
{
for (QWaylandDisplay::RegistryGlobal global : display->globals()) {
if (global.interface == QLatin1String("zxdg_shell_v6")) {
m_xdgShell = new QWaylandXdgShellV6(display->wl_registry(), global.id, global.version);
m_xdgShell.reset(new QWaylandXdgShellV6(display->wl_registry(), global.id, global.version));
break;
}
}
}
QWaylandXdgShellV6Integration *QWaylandXdgShellV6Integration::create(QWaylandDisplay *display)
{
if (!display->hasRegistryGlobal(QLatin1String("zxdg_shell_v6")))
return nullptr;
if (!m_xdgShell) {
qCDebug(lcQpaWayland) << "Couldn't find global zxdg_shell_v6 for xdg-shell unstable v6";
return false;
}
QScopedPointer<QWaylandXdgShellV6Integration> integration;
integration.reset(new QWaylandXdgShellV6Integration(display));
if (integration && !integration->initialize(display))
return nullptr;
return integration.take();
}
bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display)
{
QWaylandShellIntegration::initialize(display);
return m_xdgShell != nullptr;
return QWaylandShellIntegration::initialize(display);
}
QWaylandShellSurface *QWaylandXdgShellV6Integration::createShellSurface(QWaylandWindow *window)

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <wayland-client.h>
#include "qwaylandxdgshellv6_p.h"
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
@ -59,20 +59,16 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
class QWaylandXdgShellV6;
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6Integration : public QWaylandShellIntegration
{
public:
static QWaylandXdgShellV6Integration *create(QWaylandDisplay* display);
QWaylandXdgShellV6Integration() {}
bool initialize(QWaylandDisplay *display) override;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override;
private:
QWaylandXdgShellV6Integration(QWaylandDisplay *display);
QWaylandXdgShellV6 *m_xdgShell = nullptr;
QScopedPointer<QWaylandXdgShellV6> m_xdgShell;
};
}

View File

@ -0,0 +1,3 @@
{
"Keys":[ "xdg-shell-v6" ]
}

View File

@ -0,0 +1,23 @@
QT += gui-private waylandclient-private
CONFIG += wayland-scanner
QMAKE_USE += wayland-client
WAYLANDCLIENTSOURCES += \
../../../3rdparty/protocol/xdg-shell-unstable-v6.xml
HEADERS += \
qwaylandxdgshellv6_p.h \
qwaylandxdgshellv6integration_p.h \
SOURCES += \
main.cpp \
qwaylandxdgshellv6.cpp \
qwaylandxdgshellv6integration.cpp \
OTHER_FILES += \
xdg-shell-v6.json
PLUGIN_TYPE = wayland-shell-integration
PLUGIN_CLASS_NAME = QWaylandXdgShellV6IntegrationPlugin
load(qt_plugin)

View File

@ -77,7 +77,6 @@
#include "qwaylandshellintegration_p.h"
#include "qwaylandshellintegrationfactory_p.h"
#include "qwaylandxdgshellv6integration_p.h"
#include "qwaylandinputdeviceintegration_p.h"
#include "qwaylandinputdeviceintegrationfactory_p.h"
@ -441,9 +440,7 @@ void QWaylandIntegration::initializeInputDeviceIntegration()
QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName)
{
if (integrationName == QLatin1Literal("xdg-shell-v6")) {
return QWaylandXdgShellV6Integration::create(mDisplay.data());
} else if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) {
if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) {
return QWaylandShellIntegrationFactory::create(integrationName, mDisplay.data());
} else {
qCWarning(lcQpaWayland) << "No shell integration named" << integrationName << "found";