summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/client.pro9
-rw-r--r--src/client/qwaylanddisplay.cpp3
-rw-r--r--src/client/qwaylanddisplay_p.h1
-rw-r--r--src/client/qwaylandintegration.cpp12
-rw-r--r--src/client/qwaylandwindow.cpp1
-rw-r--r--src/client/qwaylandwlshellintegration.cpp12
-rw-r--r--src/client/qwaylandxdgpopup.cpp78
-rw-r--r--src/client/qwaylandxdgpopup_p.h91
-rw-r--r--src/client/qwaylandxdgshell.cpp106
-rw-r--r--src/client/qwaylandxdgshell_p.h95
-rw-r--r--src/client/qwaylandxdgshellintegration.cpp93
-rw-r--r--src/client/qwaylandxdgshellintegration_p.h82
-rw-r--r--src/client/qwaylandxdgshellv6integration.cpp12
-rw-r--r--src/client/qwaylandxdgsurface.cpp241
-rw-r--r--src/client/qwaylandxdgsurface_p.h133
-rw-r--r--src/client/shellintegration/qwaylandshellintegrationfactory.cpp17
-rw-r--r--src/client/shellintegration/qwaylandshellintegrationfactory_p.h5
17 files changed, 38 insertions, 953 deletions
diff --git a/src/client/client.pro b/src/client/client.pro
index eae7ad52e..1bcd6780c 100644
--- a/src/client/client.pro
+++ b/src/client/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/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index a9fff410a..515888d4a 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/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 <QtWaylandClient/private/qwayland-text-input-unstable-v2.h>
-#include <QtWaylandClient/private/qwayland-xdg-shell.h>
#include <QtCore/QAbstractEventDispatcher>
#include <QtGui/private/qguiapplication_p.h>
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index a65ed320d..aa84a97b7 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -63,7 +63,6 @@
#include <QtWaylandClient/private/qwayland-wayland.h>
#include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
-#include <QtWaylandClient/private/qwayland-xdg-shell.h>
#include <QtWaylandClient/private/qwaylandshm_p.h>
struct wl_cursor_image;
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
index b804988b2..2a169aca6 100644
--- a/src/client/qwaylandintegration.cpp
+++ b/src/client/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/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 21c9f82b0..45f9a19b2 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/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/client/qwaylandwlshellintegration.cpp b/src/client/qwaylandwlshellintegration.cpp
index 81c46be29..c76628420 100644
--- a/src/client/qwaylandwlshellintegration.cpp
+++ b/src/client/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<QWaylandWlShellIntegration> integration;
+ integration.reset(new QWaylandWlShellIntegration(display));
+ if (integration && !integration->initialize(display))
+ return nullptr;
+
+ return integration.take();
}
QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display)
diff --git a/src/client/qwaylandxdgpopup.cpp b/src/client/qwaylandxdgpopup.cpp
deleted file mode 100644
index 46a12a828..000000000
--- a/src/client/qwaylandxdgpopup.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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 "qwaylandxdgpopup_p.h"
-
-#include "qwaylandwindow_p.h"
-#include "qwaylanddisplay_p.h"
-#include "qwaylandextendedsurface_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXdgPopup::QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window)
- : QWaylandShellSurface(window)
- , QtWayland::xdg_popup(popup)
- , m_window(window)
-{
- if (window->display()->windowExtension())
- m_extendedWindow = new QWaylandExtendedSurface(window);
-}
-
-QWaylandXdgPopup::~QWaylandXdgPopup()
-{
- xdg_popup_destroy(object());
- delete m_extendedWindow;
-}
-
-void QWaylandXdgPopup::setType(Qt::WindowType type, QWaylandWindow *transientParent)
-{
- Q_UNUSED(type);
- Q_UNUSED(transientParent);
-}
-
-void QWaylandXdgPopup::xdg_popup_popup_done()
-{
- m_window->window()->close();
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/client/qwaylandxdgpopup_p.h b/src/client/qwaylandxdgpopup_p.h
deleted file mode 100644
index b027c05dc..000000000
--- a/src/client/qwaylandxdgpopup_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGPOPUP_P_H
-#define QWAYLANDXDGPOPUP_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <wayland-client.h>
-
-#include <QtWaylandClient/qtwaylandclientglobal.h>
-#include <QtWaylandClient/private/qwayland-xdg-shell.h>
-#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-class QWaylandExtendedSurface;
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgPopup : public QWaylandShellSurface
- , public QtWayland::xdg_popup
-{
- Q_OBJECT
-public:
- QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window);
- ~QWaylandXdgPopup() override;
-
- void setType(Qt::WindowType type, QWaylandWindow *transientParent) override;
-
-protected:
- void xdg_popup_popup_done() override;
-
-private:
- QWaylandExtendedSurface *m_extendedWindow = nullptr;
- QWaylandWindow *m_window = nullptr;
-};
-
-QT_END_NAMESPACE
-
-}
-
-#endif // QWAYLANDXDGPOPUP_P_H
diff --git a/src/client/qwaylandxdgshell.cpp b/src/client/qwaylandxdgshell.cpp
deleted file mode 100644
index 9a34e72dd..000000000
--- a/src/client/qwaylandxdgshell.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
-** Contact: https://www.qt.io/licensing/
-**
-** 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 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 "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 <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell)
- : QtWayland::xdg_shell(shell)
-{
-}
-
-QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id)
- : QtWayland::xdg_shell(registry, id, 1)
-{
- use_unstable_version(QtWayland::xdg_shell::version_current);
-}
-
-QWaylandXdgShell::~QWaylandXdgShell()
-{
- xdg_shell_destroy(object());
-}
-
-QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window)
-{
- return new QWaylandXdgSurface(this, window);
-}
-
-QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice)
-{
- QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last();
- ::wl_surface *parentSurface = parentWindow->object();
-
- if (m_popupSerial == 0)
- m_popupSerial = inputDevice->serial();
- ::wl_seat *seat = inputDevice->wl_seat();
-
- QPoint position = window->geometry().topLeft() - parentWindow->geometry().topLeft();
- int x = position.x() + parentWindow->frameMargins().left();
- int y = position.y() + parentWindow->frameMargins().top();
-
- auto popup = new QWaylandXdgPopup(get_xdg_popup(window->object(), parentSurface, seat, m_popupSerial, x, y), window);
- m_popups.append(window);
- QObject::connect(popup, &QWaylandXdgPopup::destroyed, [this, window](){
- m_popups.removeOne(window);
- if (m_popups.empty())
- m_popupSerial = 0;
- });
- return popup;
-}
-
-void QWaylandXdgShell::xdg_shell_ping(uint32_t serial)
-{
- pong(serial);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/client/qwaylandxdgshell_p.h b/src/client/qwaylandxdgshell_p.h
deleted file mode 100644
index 761f25218..000000000
--- a/src/client/qwaylandxdgshell_p.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Eurogiciel, author: <philippe.coval@eurogiciel.fr>
-** Contact: https://www.qt.io/licensing/
-**
-** 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 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELL_H
-#define QWAYLANDXDGSHELL_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QSize>
-#include <QtCore/QVector>
-
-#include <wayland-client.h>
-
-#include <QtWaylandClient/private/qwayland-xdg-shell.h>
-#include <QtWaylandClient/qtwaylandclientglobal.h>
-#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-class QWaylandInputDevice;
-class QWaylandXdgSurface;
-class QWaylandXdgPopup;
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell
-{
-public:
- QWaylandXdgShell(struct ::xdg_shell *shell);
- QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id);
- ~QWaylandXdgShell() override;
-
- QWaylandXdgSurface *createXdgSurface(QWaylandWindow *window);
- QWaylandXdgPopup *createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice);
-
-private:
- void xdg_shell_ping(uint32_t serial) override;
-
- QVector<QWaylandWindow *> m_popups;
- uint m_popupSerial = 0;
-};
-
-QT_END_NAMESPACE
-
-}
-
-#endif // QWAYLANDXDGSHELL_H
diff --git a/src/client/qwaylandxdgshellintegration.cpp b/src/client/qwaylandxdgshellintegration.cpp
deleted file mode 100644
index ee72c2d52..000000000
--- a/src/client/qwaylandxdgshellintegration.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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 "qwaylandxdgshellintegration_p.h"
-
-#include <QtWaylandClient/private/qwaylandwindow_p.h>
-#include <QtWaylandClient/private/qwaylanddisplay_p.h>
-#include <QtWaylandClient/private/qwaylandxdgsurface_p.h>
-#include <QtWaylandClient/private/qwaylandxdgpopup_p.h>
-#include <QtWaylandClient/private/qwaylandxdgshell_p.h>
-
-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)
-{
- Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) {
- if (global.interface == QLatin1String("xdg_shell")) {
- m_xdgShell = new QWaylandXdgShell(display->wl_registry(), global.id);
- break;
- }
- }
-}
-
-bool QWaylandXdgShellIntegration::initialize(QWaylandDisplay *display)
-{
- QWaylandShellIntegration::initialize(display);
- return m_xdgShell != nullptr;
-}
-
-QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window)
-{
- QWaylandInputDevice *inputDevice = window->display()->lastInputDevice();
- if (window->window()->type() == Qt::WindowType::Popup && inputDevice)
- return m_xdgShell->createXdgPopup(window, inputDevice);
- else
- return m_xdgShell->createXdgSurface(window);
-}
-
-void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {
- if (newFocus && qobject_cast<QWaylandXdgPopup *>(newFocus->shellSurface()))
- m_display->handleWindowActivated(newFocus);
- if (oldFocus && qobject_cast<QWaylandXdgPopup *>(oldFocus->shellSurface()))
- m_display->handleWindowDeactivated(oldFocus);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/client/qwaylandxdgshellintegration_p.h b/src/client/qwaylandxdgshellintegration_p.h
deleted file mode 100644
index ed307a5de..000000000
--- a/src/client/qwaylandxdgshellintegration_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSHELLINTEGRATION_P_H
-#define QWAYLANDXDGSHELLINTEGRATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <wayland-client.h>
-
-#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-class QWaylandXdgShell;
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration
-{
-public:
- static QWaylandXdgShellIntegration *create(QWaylandDisplay* display);
- 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;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDXDGSHELLINTEGRATION_P_H
diff --git a/src/client/qwaylandxdgshellv6integration.cpp b/src/client/qwaylandxdgshellv6integration.cpp
index 2713ac37b..0eb6b5929 100644
--- a/src/client/qwaylandxdgshellv6integration.cpp
+++ b/src/client/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<QWaylandXdgShellV6Integration> 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/client/qwaylandxdgsurface.cpp b/src/client/qwaylandxdgsurface.cpp
deleted file mode 100644
index 5b5aacbf4..000000000
--- a/src/client/qwaylandxdgsurface.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 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 "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"
-
-
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient {
-
-QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window)
- : QWaylandShellSurface(window)
- , QtWayland::xdg_surface(shell->get_xdg_surface(window->object()))
- , m_window(window)
- , m_shell(shell)
-{
- if (window->display()->windowExtension())
- m_extendedWindow = new QWaylandExtendedSurface(window);
-}
-
-QWaylandXdgSurface::~QWaylandXdgSurface()
-{
- if (m_acked.states & Qt::WindowActive)
- window()->display()->handleWindowDeactivated(m_window);
-
- xdg_surface_destroy(object());
- delete m_extendedWindow;
-}
-
-void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges)
-{
- // May need some conversion if types get incompatibles, ATM they're identical
- enum resize_edge const * const arg = reinterpret_cast<enum resize_edge const * const>(&edges);
- resize(inputDevice, *arg);
-}
-
-void QWaylandXdgSurface::resize(QWaylandInputDevice *inputDevice, enum resize_edge edges)
-{
- resize(inputDevice->wl_seat(),
- inputDevice->serial(),
- edges);
-}
-
-bool QWaylandXdgSurface::move(QWaylandInputDevice *inputDevice)
-{
- move(inputDevice->wl_seat(),
- inputDevice->serial());
- return true;
-}
-
-void QWaylandXdgSurface::updateTransientParent(QWaylandWindow *parent)
-{
- if (!parent)
- return;
- auto parentXdgSurface = qobject_cast<QWaylandXdgSurface *>(parent->shellSurface());
- Q_ASSERT(parentXdgSurface);
- set_parent(parentXdgSurface->object());
-}
-
-void QWaylandXdgSurface::setTitle(const QString & title)
-{
- return QtWayland::xdg_surface::set_title(title);
-}
-
-void QWaylandXdgSurface::setAppId(const QString & appId)
-{
- return QtWayland::xdg_surface::set_app_id(appId);
-}
-
-void QWaylandXdgSurface::raise()
-{
- if (m_extendedWindow)
- m_extendedWindow->raise();
-}
-
-void QWaylandXdgSurface::lower()
-{
- if (m_extendedWindow)
- m_extendedWindow->lower();
-}
-
-void QWaylandXdgSurface::setContentOrientationMask(Qt::ScreenOrientations orientation)
-{
- if (m_extendedWindow)
- m_extendedWindow->setContentOrientationMask(orientation);
-}
-
-void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags)
-{
- if (m_extendedWindow)
- m_extendedWindow->setWindowFlags(flags);
-}
-
-void QWaylandXdgSurface::sendProperty(const QString &name, const QVariant &value)
-{
- if (m_extendedWindow)
- m_extendedWindow->updateGenericProperty(name, value);
-}
-
-void QWaylandXdgSurface::setType(Qt::WindowType type, QWaylandWindow *transientParent)
-{
- Q_UNUSED(type)
- if (transientParent)
- updateTransientParent(transientParent);
-}
-
-void QWaylandXdgSurface::applyConfigure()
-{
- if (m_pending.isResizing)
- m_normalSize = m_pending.size;
- else if (!(m_acked.states & (Qt::WindowMaximized|Qt::WindowFullScreen)))
- m_normalSize = m_window->window()->frameGeometry().size();
-
- if ((m_pending.states & Qt::WindowActive) && !(m_acked.states & Qt::WindowActive))
- m_window->display()->handleWindowActivated(m_window);
-
- if (!(m_pending.states & Qt::WindowActive) && (m_acked.states & Qt::WindowActive))
- m_window->display()->handleWindowDeactivated(m_window);
-
- // TODO: none of the other plugins send WindowActive either, but is it on purpose?
- Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive;
-
- m_window->handleWindowStatesChanged(statesWithoutActive);
- if (!m_pending.size.isEmpty())
- m_window->resizeFromApplyConfigure(m_pending.size);
- else if (!m_normalSize.isEmpty())
- m_window->resizeFromApplyConfigure(m_normalSize);
- ack_configure(m_pending.serial);
- m_acked = m_pending;
-}
-
-void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states)
-{
- Qt::WindowStates changedStates = m_acked.states ^ states;
-
- if (changedStates & Qt::WindowMaximized) {
- if (states & Qt::WindowMaximized)
- set_maximized();
- else
- unset_maximized();
- }
-
- if (changedStates & Qt::WindowFullScreen) {
- if (states & Qt::WindowFullScreen)
- set_fullscreen(nullptr);
- else
- unset_fullscreen();
- }
-
- // Minimized state is not reported by the protocol, so always send it
- if (states & Qt::WindowMinimized) {
- set_minimized();
- window()->handleWindowStatesChanged(states & ~Qt::WindowMinimized);
- }
-}
-
-bool QWaylandXdgSurface::wantsDecorations() const
-{
- return !(m_pending.states & Qt::WindowFullScreen);
-}
-
-void QWaylandXdgSurface::xdg_surface_configure(int32_t width, int32_t height, struct wl_array *states,uint32_t serial)
-{
- uint32_t *xdgStates = reinterpret_cast<uint32_t*>(states->data);
- size_t numStates = states->size / sizeof(uint32_t);
- m_pending.serial = serial;
- m_pending.size = QSize(width, height);
- m_pending.isResizing = false;
- m_pending.states = Qt::WindowNoState;
- for (size_t i = 0; i < numStates; i++) {
- switch (xdgStates[i]) {
- case XDG_SURFACE_STATE_MAXIMIZED:
- m_pending.states |= Qt::WindowMaximized;
- break;
- case XDG_SURFACE_STATE_FULLSCREEN:
- m_pending.states |= Qt::WindowFullScreen;
- break;
- case XDG_SURFACE_STATE_RESIZING:
- m_pending.isResizing = true;
- break;
- case XDG_SURFACE_STATE_ACTIVATED:
- m_pending.states |= Qt::WindowActive;
- break;
- default:
- break;
- }
- }
- m_window->applyConfigureWhenPossible();
-}
-
-void QWaylandXdgSurface::xdg_surface_close()
-{
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h
deleted file mode 100644
index 059e79d87..000000000
--- a/src/client/qwaylandxdgsurface_p.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 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$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDXDGSURFACE_H
-#define QWAYLANDXDGSURFACE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QSize>
-#include <QtCore/QMargins>
-
-#include <wayland-client.h>
-
-#include <QtWaylandClient/qtwaylandclientglobal.h>
-#include <QtWaylandClient/private/qwayland-xdg-shell.h>
-#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-namespace QtWaylandClient {
-
-class QWaylandWindow;
-class QWaylandInputDevice;
-class QWaylandExtendedSurface;
-class QWaylandXdgShell;
-
-class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface
- , public QtWayland::xdg_surface
-{
- Q_OBJECT
-public:
- QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window);
- ~QWaylandXdgSurface() override;
-
- using QtWayland::xdg_surface::resize;
- void resize(QWaylandInputDevice *inputDevice, enum resize_edge edges);
-
- void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override;
-
- using QtWayland::xdg_surface::move;
- bool move(QWaylandInputDevice *inputDevice) override;
-
- void setTitle(const QString &title) override;
- void setAppId(const QString &appId) override;
-
- void raise() override;
- void lower() override;
- void setContentOrientationMask(Qt::ScreenOrientations orientation) override;
- void setWindowFlags(Qt::WindowFlags flags) override;
- void sendProperty(const QString &name, const QVariant &value) override;
-
- void setType(Qt::WindowType type, QWaylandWindow *transientParent) override;
- void applyConfigure() override;
- void requestWindowStates(Qt::WindowStates states) override;
- bool wantsDecorations() const override;
-
-private:
- void updateTransientParent(QWaylandWindow *parent);
-
-private:
- QWaylandWindow *m_window = nullptr;
- QWaylandXdgShell* m_shell = nullptr;
- struct {
- Qt::WindowStates states = Qt::WindowNoState;
- bool isResizing = false;
- QSize size = {0, 0};
- uint serial = 0;
- } m_acked, m_pending;
- QSize m_normalSize;
- QMargins m_margins;
- QWaylandExtendedSurface *m_extendedWindow = nullptr;
-
- void xdg_surface_configure(int32_t width,
- int32_t height,
- struct wl_array *states,
- uint32_t serial) override;
- void xdg_surface_close() override;
-
- friend class QWaylandWindow;
-};
-
-QT_END_NAMESPACE
-
-}
-
-#endif // QWAYLANDXDGSURFACE_H
diff --git a/src/client/shellintegration/qwaylandshellintegrationfactory.cpp b/src/client/shellintegration/qwaylandshellintegrationfactory.cpp
index c5a505bbe..48fda14d4 100644
--- a/src/client/shellintegration/qwaylandshellintegrationfactory.cpp
+++ b/src/client/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<QWaylandShellIntegration> integration;
+
// Try loading the plugin from platformPluginPath first:
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
- if (QWaylandShellIntegration *ret = qLoadPlugin<QWaylandShellIntegration, QWaylandShellIntegrationPlugin>(directLoader(), name, args))
- return ret;
+ integration.reset(qLoadPlugin<QWaylandShellIntegration, QWaylandShellIntegrationPlugin>(directLoader(), name, args));
}
- if (QWaylandShellIntegration *ret = qLoadPlugin<QWaylandShellIntegration, QWaylandShellIntegrationPlugin>(loader(), name, args))
- return ret;
+ if (!integration)
+ integration.reset(qLoadPlugin<QWaylandShellIntegration, QWaylandShellIntegrationPlugin>(loader(), name, args));
#endif
- return nullptr;
+
+ if (integration && !integration->initialize(display))
+ return nullptr;
+
+ return integration.take();
}
}
diff --git a/src/client/shellintegration/qwaylandshellintegrationfactory_p.h b/src/client/shellintegration/qwaylandshellintegrationfactory_p.h
index 3edb0a89d..515a18e1f 100644
--- a/src/client/shellintegration/qwaylandshellintegrationfactory_p.h
+++ b/src/client/shellintegration/qwaylandshellintegrationfactory_p.h
@@ -51,7 +51,10 @@
// We mean it.
//
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+
#include <QtWaylandClient/qtwaylandclientglobal.h>
+
#include <QtCore/QStringList>
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());
};
}