From 7ef6c33a690cc1152ff3a049c9fcc578752d944a Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 8 May 2018 16:31:16 +0200 Subject: [PATCH] Move xdg-shell-v5 to a plugin This is the first step in deprecating xdg-shell unstable v5 and making the good names available for the good names for xdg-shell stable. Shell initialization has been refactored slightly, so the QWaylandShellIntegrationFactory actually tries to initialize the shell integration before returning it. Similarly for the factory method of non-plugin shells. Change-Id: I85e60594c4fc03c6f302c04316110aed428d28dc Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/client.pro | 9 --- .../shellintegration/shellintegration.pro | 4 +- .../shellintegration/xdg-shell-v5/main.cpp | 70 +++++++++++++++++++ .../xdg-shell-v5}/qwaylandxdgpopup.cpp | 6 +- .../xdg-shell-v5}/qwaylandxdgpopup_p.h | 3 +- .../xdg-shell-v5}/qwaylandxdgshell.cpp | 10 +-- .../xdg-shell-v5}/qwaylandxdgshell_p.h | 3 +- .../qwaylandxdgshellintegration.cpp | 28 +++----- .../qwaylandxdgshellintegration_p.h | 8 +-- .../xdg-shell-v5}/qwaylandxdgsurface.cpp | 16 ++--- .../xdg-shell-v5}/qwaylandxdgsurface_p.h | 9 +-- .../xdg-shell-v5/xdg-shell-v5.json | 3 + .../xdg-shell-v5/xdg-shell-v5.pro | 30 ++++++++ .../platforms/wayland/qwaylanddisplay.cpp | 3 - .../platforms/wayland/qwaylanddisplay_p.h | 1 - .../platforms/wayland/qwaylandintegration.cpp | 12 ++-- .../platforms/wayland/qwaylandwindow.cpp | 1 - .../wayland/qwaylandwlshellintegration.cpp | 12 +++- .../wayland/qwaylandxdgshellv6integration.cpp | 12 +++- .../qwaylandshellintegrationfactory.cpp | 17 +++-- .../qwaylandshellintegrationfactory_p.h | 5 +- 21 files changed, 183 insertions(+), 79 deletions(-) create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgpopup.cpp (93%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgpopup_p.h (98%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgshell.cpp (94%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgshell_p.h (98%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgshellintegration.cpp (82%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgshellintegration_p.h (93%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgsurface.cpp (94%) rename src/plugins/platforms/wayland/{ => plugins/shellintegration/xdg-shell-v5}/qwaylandxdgsurface_p.h (98%) create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json create mode 100644 src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro diff --git a/src/plugins/platforms/wayland/client.pro b/src/plugins/platforms/wayland/client.pro index eae7ad52ea2..1bcd6780c5b 100644 --- a/src/plugins/platforms/wayland/client.pro +++ b/src/plugins/platforms/wayland/client.pro @@ -28,7 +28,6 @@ WAYLANDCLIENTSOURCES += \ ../extensions/qtkey-extension.xml \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ - ../3rdparty/protocol/xdg-shell.xml \ ../3rdparty/protocol/xdg-shell-unstable-v6.xml \ WAYLANDCLIENTSOURCES_SYSTEM += \ @@ -45,10 +44,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandshellsurface.cpp \ qwaylandwlshellsurface.cpp \ qwaylandwlshellintegration.cpp \ - qwaylandxdgshell.cpp \ - qwaylandxdgsurface.cpp \ - qwaylandxdgpopup.cpp \ - qwaylandxdgshellintegration.cpp \ qwaylandxdgshellv6.cpp \ qwaylandxdgshellv6integration.cpp \ qwaylandextendedsurface.cpp \ @@ -78,10 +73,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandshellsurface_p.h \ qwaylandwlshellsurface_p.h \ qwaylandwlshellintegration_p.h \ - qwaylandxdgshell_p.h \ - qwaylandxdgsurface_p.h \ - qwaylandxdgpopup_p.h \ - qwaylandxdgshellintegration_p.h \ qwaylandxdgshellv6_p.h \ qwaylandxdgshellv6integration_p.h \ qwaylandextendedsurface_p.h \ diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro index 9867d2b4035..7f465d61b4c 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro +++ b/src/plugins/platforms/wayland/plugins/shellintegration/shellintegration.pro @@ -1,3 +1,5 @@ TEMPLATE = subdirs -SUBDIRS += ivi-shell +SUBDIRS += \ + ivi-shell \ + xdg-shell-v5 diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp new file mode 100644 index 00000000000..3df1beaf953 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/main.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2017 ITAGE Corporation, author: +** 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 "qwaylandxdgshellintegration_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandXdgShellV5IntegrationPlugin : public QWaylandShellIntegrationPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "xdg-shell-v5.json") + +public: + QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override; +}; + +QWaylandShellIntegration *QWaylandXdgShellV5IntegrationPlugin::create(const QString &key, const QStringList ¶mList) +{ + qDebug() << Q_FUNC_INFO; + Q_UNUSED(key); + Q_UNUSED(paramList); + return new QWaylandXdgShellIntegration(); +} + +} + +QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup.cpp similarity index 93% rename from src/plugins/platforms/wayland/qwaylandxdgpopup.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup.cpp index 46a12a828a1..04849355f5e 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup.cpp @@ -39,9 +39,9 @@ #include "qwaylandxdgpopup_p.h" -#include "qwaylandwindow_p.h" -#include "qwaylanddisplay_p.h" -#include "qwaylandextendedsurface_p.h" +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandxdgpopup_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h index b027c05dc72..d9f7deec642 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgpopup_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgpopup_p.h @@ -51,10 +51,11 @@ // We mean it. // +#include "qwayland-xdg-shell.h" + #include #include -#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell.cpp similarity index 94% rename from src/plugins/platforms/wayland/qwaylandxdgshell.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell.cpp index 9a34e72dd1c..bd76346d2ae 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell.cpp @@ -38,16 +38,16 @@ ****************************************************************************/ #include "qwaylandxdgshell_p.h" - -#include "qwaylanddisplay_p.h" -#include "qwaylandwindow_p.h" -#include "qwaylandinputdevice_p.h" -#include "qwaylandscreen_p.h" #include "qwaylandxdgpopup_p.h" #include "qwaylandxdgsurface_p.h" #include +#include +#include +#include +#include + QT_BEGIN_NAMESPACE namespace QtWaylandClient { diff --git a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandxdgshell_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h index 761f25218f6..9341c7a8fb4 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshell_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshell_p.h @@ -51,12 +51,13 @@ // We mean it. // +#include "qwayland-xdg-shell.h" + #include #include #include -#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration.cpp similarity index 82% rename from src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration.cpp index ee72c2d5212..0d0e8aba3ac 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration.cpp @@ -38,38 +38,32 @@ ****************************************************************************/ #include "qwaylandxdgshellintegration_p.h" +#include "qwaylandxdgsurface_p.h" +#include "qwaylandxdgpopup_p.h" +#include "qwaylandxdgshell_p.h" #include #include -#include -#include -#include QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandXdgShellIntegration *QWaylandXdgShellIntegration::create(QWaylandDisplay *display) -{ - if (display->hasRegistryGlobal(QLatin1String("xdg_shell"))) - return new QWaylandXdgShellIntegration(display); - return nullptr; -} - -QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display) +bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) { Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { if (global.interface == QLatin1String("xdg_shell")) { - m_xdgShell = new QWaylandXdgShell(display->wl_registry(), global.id); + m_xdgShell.reset(new QWaylandXdgShell(display->wl_registry(), global.id)); break; } } -} -bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display) -{ - QWaylandShellIntegration::initialize(display); - return m_xdgShell != nullptr; + if (!m_xdgShell) { + qWarning() << "Couldn't find global xdg_shell for xdg-shell unstable v5"; + return false; + } + + return QWaylandShellIntegration::initialize(display); } QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration_p.h similarity index 93% rename from src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration_p.h index ed307a5de8b..a3ff86cd763 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellintegration_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellintegration_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include +#include "qwaylandxdgshell_p.h" #include @@ -64,15 +64,13 @@ class QWaylandXdgShell; class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration { public: - static QWaylandXdgShellIntegration *create(QWaylandDisplay* display); + QWaylandXdgShellIntegration() {qDebug() << Q_FUNC_INFO;} bool initialize(QWaylandDisplay *display) override; QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override; private: - QWaylandXdgShellIntegration(QWaylandDisplay *display); - - QWaylandXdgShell *m_xdgShell = nullptr; + QScopedPointer m_xdgShell; }; } diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface.cpp similarity index 94% rename from src/plugins/platforms/wayland/qwaylandxdgsurface.cpp rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface.cpp index 5b5aacbf4d6..ec096540a3d 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the config.tests of the Qt Toolkit. @@ -38,15 +38,15 @@ ****************************************************************************/ #include "qwaylandxdgsurface_p.h" - -#include "qwaylanddisplay_p.h" -#include "qwaylandwindow_p.h" -#include "qwaylandinputdevice_p.h" -#include "qwaylandabstractdecoration_p.h" -#include "qwaylandscreen_p.h" -#include "qwaylandextendedsurface_p.h" #include "qwaylandxdgshell_p.h" +#include +#include +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h similarity index 98% rename from src/plugins/platforms/wayland/qwaylandxdgsurface_p.h rename to src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h index 059e79d8736..cf4498a8372 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgsurface_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurface_p.h @@ -51,15 +51,16 @@ // We mean it. // +#include "qwayland-xdg-shell.h" + +#include +#include + #include #include #include -#include -#include -#include - QT_BEGIN_NAMESPACE class QWindow; diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json new file mode 100644 index 00000000000..ba1ed448920 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.json @@ -0,0 +1,3 @@ +{ + "Keys":[ "xdg-shell-v5" ] +} diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro new file mode 100644 index 00000000000..85052fef6f3 --- /dev/null +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell-v5/xdg-shell-v5.pro @@ -0,0 +1,30 @@ +QT += gui-private waylandclient-private +CONFIG += wayland-scanner + +QMAKE_USE += wayland-client + +qtConfig(xkbcommon-evdev): \ + QMAKE_USE += xkbcommon_evdev + +WAYLANDCLIENTSOURCES += \ + ../../../3rdparty/protocol/xdg-shell.xml + +HEADERS += \ + qwaylandxdgpopup_p.h \ + qwaylandxdgshell_p.h \ + qwaylandxdgshellintegration_p.h \ + qwaylandxdgsurface_p.h \ + +SOURCES += \ + main.cpp \ + qwaylandxdgpopup.cpp \ + qwaylandxdgshell.cpp \ + qwaylandxdgshellintegration.cpp \ + qwaylandxdgsurface.cpp \ + +OTHER_FILES += \ + xdg-shell-v5.json + +PLUGIN_TYPE = wayland-shell-integration +PLUGIN_CLASS_NAME = QWaylandXdgShellV5IntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index a9fff410a4a..515888d4afe 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -51,8 +51,6 @@ #include "qwaylanddatadevicemanager_p.h" #endif #include "qwaylandhardwareintegration_p.h" -#include "qwaylandxdgshell_p.h" -#include "qwaylandxdgsurface_p.h" #include "qwaylandwlshellsurface_p.h" #include "qwaylandinputcontext_p.h" @@ -66,7 +64,6 @@ #include "qwaylandqtkey_p.h" #include -#include #include #include diff --git a/src/plugins/platforms/wayland/qwaylanddisplay_p.h b/src/plugins/platforms/wayland/qwaylanddisplay_p.h index a65ed320d2a..aa84a97b7b3 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay_p.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay_p.h @@ -63,7 +63,6 @@ #include #include -#include #include struct wl_cursor_image; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index b804988b2cf..2a169aca652 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -77,7 +77,6 @@ #include "qwaylandshellintegration_p.h" #include "qwaylandshellintegrationfactory_p.h" -#include "qwaylandxdgshellintegration_p.h" #include "qwaylandwlshellintegration_p.h" #include "qwaylandxdgshellv6integration_p.h" @@ -409,9 +408,9 @@ void QWaylandIntegration::initializeShellIntegration() } } - if (!mShellIntegration || !mShellIntegration->initialize(mDisplay.data())) { - mShellIntegration.reset(); - qWarning("Failed to load shell integration %s", qPrintable(targetKey)); + if (!mShellIntegration) { + qCWarning(lcQpaWayland) << "Loading shell integration failed."; + qCWarning(lcQpaWayland) << "Attempted to load the following shells" << preferredShells; } } @@ -445,13 +444,12 @@ QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QStr { if (integrationName == QLatin1Literal("wl-shell")) { return QWaylandWlShellIntegration::create(mDisplay.data()); - } else if (integrationName == QLatin1Literal("xdg-shell-v5")) { - return QWaylandXdgShellIntegration::create(mDisplay.data()); } else if (integrationName == QLatin1Literal("xdg-shell-v6")) { return QWaylandXdgShellV6Integration::create(mDisplay.data()); } else if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) { - return QWaylandShellIntegrationFactory::create(integrationName, QStringList()); + return QWaylandShellIntegrationFactory::create(integrationName, mDisplay.data()); } else { + qCWarning(lcQpaWayland) << "No shell integration named" << integrationName << "found"; return nullptr; } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 21c9f82b07b..45f9a19b2fd 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -45,7 +45,6 @@ #include "qwaylandscreen_p.h" #include "qwaylandshellsurface_p.h" #include "qwaylandwlshellsurface_p.h" -#include "qwaylandxdgsurface_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandabstractdecoration_p.h" #include "qwaylandwindowmanagerintegration_p.h" diff --git a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp index 81c46be29e6..c76628420c0 100644 --- a/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp @@ -49,9 +49,15 @@ namespace QtWaylandClient { QWaylandWlShellIntegration *QWaylandWlShellIntegration::create(QWaylandDisplay *display) { - if (display->hasRegistryGlobal(QLatin1String("wl_shell"))) - return new QWaylandWlShellIntegration(display); - return nullptr; + if (!display->hasRegistryGlobal(QLatin1String("wl_shell"))) + return nullptr; + + QScopedPointer integration; + integration.reset(new QWaylandWlShellIntegration(display)); + if (integration && !integration->initialize(display)) + return nullptr; + + return integration.take(); } QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp index 2713ac37b9f..0eb6b592925 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp @@ -59,9 +59,15 @@ QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *di QWaylandXdgShellV6Integration *QWaylandXdgShellV6Integration::create(QWaylandDisplay *display) { - if (display->hasRegistryGlobal(QLatin1String("zxdg_shell_v6"))) - return new QWaylandXdgShellV6Integration(display); - return nullptr; + if (!display->hasRegistryGlobal(QLatin1String("zxdg_shell_v6"))) + return nullptr; + + QScopedPointer integration; + integration.reset(new QWaylandXdgShellV6Integration(display)); + if (integration && !integration->initialize(display)) + return nullptr; + + return integration.take(); } bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display) diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index c5a505bbe0b..48fda14d41b 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -78,19 +78,24 @@ QStringList QWaylandShellIntegrationFactory::keys(const QString &pluginPath) #endif } -QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) +QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, QWaylandDisplay *display, const QStringList &args, const QString &pluginPath) { #if QT_CONFIG(library) + QScopedPointer integration; + // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandShellIntegration *ret = qLoadPlugin(directLoader(), name, args)) - return ret; + integration.reset(qLoadPlugin(directLoader(), name, args)); } - if (QWaylandShellIntegration *ret = qLoadPlugin(loader(), name, args)) - return ret; + if (!integration) + integration.reset(qLoadPlugin(loader(), name, args)); #endif - return nullptr; + + if (integration && !integration->initialize(display)) + return nullptr; + + return integration.take(); } } diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h index 3edb0a89dbb..515a18e1f1c 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory_p.h @@ -51,7 +51,10 @@ // We mean it. // +#include + #include + #include QT_BEGIN_NAMESPACE @@ -64,7 +67,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandShellIntegrationFactory { public: static QStringList keys(const QString &pluginPath = QString()); - static QWaylandShellIntegration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString()); + static QWaylandShellIntegration *create(const QString &name, QWaylandDisplay *display, const QStringList &args = QStringList(), const QString &pluginPath = QString()); }; }