diff options
Diffstat (limited to 'src/plugins/shellintegration/wl-shell')
7 files changed, 91 insertions, 282 deletions
diff --git a/src/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/shellintegration/wl-shell/CMakeLists.txt new file mode 100644 index 000000000..09b076d00 --- /dev/null +++ b/src/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -0,0 +1,58 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +# Generated from wl-shell.pro. + +##################################################################### +## WlShellIntegrationPrivate Module: +##################################################################### + +qt_internal_add_module(WlShellIntegrationPrivate + CONFIG_MODULE_NAME wl_shell_integration + INTERNAL_MODULE + SOURCES + qwaylandwlshellintegration.cpp qwaylandwlshellintegration_p.h + qwaylandwlshellsurface.cpp qwaylandwlshellsurface_p.h + LIBRARIES + Qt::GuiPrivate + Qt::WaylandClientPrivate + Wayland::Client + PRIVATE_HEADER_FILTERS + "^qwayland-.*\.h|^wayland-.*-protocol\.h" + NO_GENERATE_CPP_EXPORTS +) + +qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate + # this is just a helper module and still part of the QtWaylandClient build + __QT_INTERNAL_WAYLAND_INCLUDE_DIR QtWaylandClient/private + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland.xml +) + +#### Keys ignored in scope 2:.:.:wl-shell-integration.pro:<TRUE>: +# MODULE = "wl_shell_integration" + +## Scopes: +##################################################################### + +qt_internal_extend_target(WlShellIntegrationPrivate CONDITION QT_FEATURE_xkbcommon + LIBRARIES + XKB::XKB +) +##################################################################### +## QWaylandWlShellIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QWaylandWlShellIntegrationPlugin + OUTPUT_NAME wl-shell-plugin + PLUGIN_TYPE wayland-shell-integration + SOURCES + main.cpp + LIBRARIES + Qt::GuiPrivate + Qt::WaylandClientPrivate + Qt::WlShellIntegrationPrivate +) + +#### Keys ignored in scope 4:.:.:wl-shell-plugin.pro:<TRUE>: +# OTHER_FILES = "wl-shell.json" diff --git a/src/plugins/shellintegration/wl-shell/main.cpp b/src/plugins/shellintegration/wl-shell/main.cpp index 9b033b5f3..9d578c58b 100644 --- a/src/plugins/shellintegration/wl-shell/main.cpp +++ b/src/plugins/shellintegration/wl-shell/main.cpp @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp> -** 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$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// Copyright (C) 2017 ITAGE Corporation, author: <yusuke.binsaki@itage.co.jp> +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandwlshellintegration_p.h" diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index ab8098062..2e2076b0a 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandwlshellintegration_p.h" #include "qwaylandwlshellsurface_p.h" @@ -47,31 +11,22 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) +QWaylandWlShellIntegration::QWaylandWlShellIntegration() : QWaylandShellIntegrationTemplate(1) { - const auto globals = display->globals(); - for (QWaylandDisplay::RegistryGlobal global : globals) { - if (global.interface == QLatin1String("wl_shell")) { - m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1); - break; - } - } - - if (!m_wlShell) { - qCDebug(lcQpaWayland) << "Couldn't find global wl_shell"; - return false; - } - qCWarning(lcQpaWayland) << "\"wl-shell\" is a deprecated shell extension, prefer using" - << "\"xdg-shell-v6\" or \"xdg-shell\" if supported by the compositor" + << "\"xdg-shell\" if supported by the compositor" << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION"; +} - return QWaylandShellIntegration::initialize(display); +QWaylandWlShellIntegration::~QWaylandWlShellIntegration() +{ + if (object()) + wl_shell_destroy(object()); } QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window) { - return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->wlSurface()), window); + return new QWaylandWlShellSurface(get_shell_surface(window->wlSurface()), window); } void *QWaylandWlShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window) diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h index 3d76cc310..312a1089a 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDWLSHELLINTEGRATION_P_H #define QWAYLANDWLSHELLINTEGRATION_P_H @@ -59,16 +23,17 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration +class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellIntegration + : public QWaylandShellIntegrationTemplate<QWaylandWlShellIntegration>, + public QtWayland::wl_shell { public: - QWaylandWlShellIntegration() {} - bool initialize(QWaylandDisplay *) override; + QWaylandWlShellIntegration(); + ~QWaylandWlShellIntegration(); QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; private: - QtWayland::wl_shell *m_wlShell = nullptr; }; } diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 48e14c753..7ffa41c91 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwaylandwlshellsurface_p.h" @@ -44,7 +8,6 @@ #include <QtWaylandClient/private/qwaylandinputdevice_p.h> #include <QtWaylandClient/private/qwaylandabstractdecoration_p.h> #include <QtWaylandClient/private/qwaylandscreen_p.h> -#include <QtWaylandClient/private/qwaylandextendedsurface_p.h> #include <QtCore/QDebug> @@ -57,9 +20,6 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_ , QtWayland::wl_shell_surface(shell_surface) , m_window(window) { - if (window->display()->windowExtension()) - m_extendedWindow = new QWaylandExtendedSurface(window); - Qt::WindowType type = window->window()->type(); auto *transientParent = window->transientParent(); if (type == Qt::Popup && transientParent && transientParent->wlSurface()) @@ -73,13 +33,13 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_ QWaylandWlShellSurface::~QWaylandWlShellSurface() { wl_shell_surface_destroy(object()); - delete m_extendedWindow; } -void QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) +bool QWaylandWlShellSurface::resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) { enum resize resizeEdges = convertToResizeEdges(edges); resize(inputDevice->wl_seat(), inputDevice->serial(), resizeEdges); + return true; } bool QWaylandWlShellSurface::move(QWaylandInputDevice *inputDevice) @@ -99,41 +59,11 @@ void QWaylandWlShellSurface::setAppId(const QString & appId) return QtWayland::wl_shell_surface::set_class(appId); } -void QWaylandWlShellSurface::raise() -{ - if (m_extendedWindow) - m_extendedWindow->raise(); -} - -void QWaylandWlShellSurface::lower() -{ - if (m_extendedWindow) - m_extendedWindow->lower(); -} - -void QWaylandWlShellSurface::setContentOrientationMask(Qt::ScreenOrientations orientation) -{ - if (m_extendedWindow) - m_extendedWindow->setContentOrientationMask(orientation); -} - -void QWaylandWlShellSurface::setWindowFlags(Qt::WindowFlags flags) -{ - if (m_extendedWindow) - m_extendedWindow->setWindowFlags(flags); -} - -void QWaylandWlShellSurface::sendProperty(const QString &name, const QVariant &value) -{ - if (m_extendedWindow) - m_extendedWindow->updateGenericProperty(name, value); -} - void QWaylandWlShellSurface::applyConfigure() { if ((m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)) && !(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) { - m_normalSize = m_window->window()->frameGeometry().size(); + m_normalSize = m_window->windowFrameGeometry().size(); } if (m_pending.states != m_applied.states) @@ -287,3 +217,5 @@ void QWaylandWlShellSurface::shell_surface_popup_done() } QT_END_NAMESPACE + +#include "moc_qwaylandwlshellsurface_p.cpp" diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h index 324c10aac..780f5f326 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QWAYLANDWLSHELLSURFACE_H #define QWAYLANDWLSHELLSURFACE_H @@ -67,7 +31,7 @@ class QWaylandWindow; class QWaylandInputDevice; class QWaylandExtendedSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurface +class Q_WAYLANDCLIENT_EXPORT QWaylandWlShellSurface : public QWaylandShellSurface , public QtWayland::wl_shell_surface { Q_OBJECT @@ -76,7 +40,7 @@ public: ~QWaylandWlShellSurface() override; using QtWayland::wl_shell_surface::resize; - void resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; + bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override; using QtWayland::wl_shell_surface::move; bool move(QWaylandInputDevice *inputDevice) override; @@ -84,15 +48,11 @@ public: 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 applyConfigure() override; bool wantsDecorations() const override; + std::any surfaceRole() const override { return object(); }; + protected: void requestWindowStates(Qt::WindowStates states) override; diff --git a/src/plugins/shellintegration/wl-shell/wl-shell.pro b/src/plugins/shellintegration/wl-shell/wl-shell.pro deleted file mode 100644 index bb2c1829a..000000000 --- a/src/plugins/shellintegration/wl-shell/wl-shell.pro +++ /dev/null @@ -1,25 +0,0 @@ -QT += gui-private waylandclient-private -CONFIG += wayland-scanner - -QMAKE_USE += wayland-client -qtConfig(xkbcommon): \ - QMAKE_USE_PRIVATE += xkbcommon - -WAYLANDCLIENTSOURCES += \ - ../../../3rdparty/protocol/wayland.xml - -HEADERS += \ - qwaylandwlshellintegration_p.h \ - qwaylandwlshellsurface_p.h \ - -SOURCES += \ - main.cpp \ - qwaylandwlshellintegration.cpp \ - qwaylandwlshellsurface.cpp \ - -OTHER_FILES += \ - wl-shell.json - -PLUGIN_TYPE = wayland-shell-integration -PLUGIN_CLASS_NAME = QWaylandWlShellIntegrationPlugin -load(qt_plugin) |