diff --git a/src/declarative/layershellqtplugin.cpp b/src/declarative/layershellqtplugin.cpp index a4f97cc..2410382 100644 --- a/src/declarative/layershellqtplugin.cpp +++ b/src/declarative/layershellqtplugin.cpp @@ -4,8 +4,8 @@ * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ -#include #include "../interfaces/window.h" +#include #include QML_DECLARE_TYPEINFO(LayerShellQt::Window, QML_HAS_ATTACHED_PROPERTIES) @@ -15,7 +15,8 @@ class Plugin : public QQmlExtensionPlugin Q_PLUGIN_METADATA(IID "org.kde.layershellqt") Q_OBJECT public: - void registerTypes(const char *uri) override { + void registerTypes(const char *uri) override + { Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.layershell")); qmlRegisterType(uri, 1, 0, "Window"); } diff --git a/src/qwaylandlayershellintegration.cpp b/src/qwaylandlayershellintegration.cpp index e4e26e7..2ae367e 100644 --- a/src/qwaylandlayershellintegration.cpp +++ b/src/qwaylandlayershellintegration.cpp @@ -32,5 +32,4 @@ QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::createShel return new QWaylandLayerSurface(this, window); } - } diff --git a/src/qwaylandlayershellintegration_p.h b/src/qwaylandlayershellintegration_p.h index 9d0dbcb..3e2306f 100644 --- a/src/qwaylandlayershellintegration_p.h +++ b/src/qwaylandlayershellintegration_p.h @@ -18,14 +18,19 @@ class QWaylandXdgActivationV1; namespace LayerShellQt { -class LAYERSHELLQT_EXPORT QWaylandLayerShellIntegration : public QtWaylandClient::QWaylandShellIntegrationTemplate, public QtWayland::zwlr_layer_shell_v1 +class LAYERSHELLQT_EXPORT QWaylandLayerShellIntegration : public QtWaylandClient::QWaylandShellIntegrationTemplate, + public QtWayland::zwlr_layer_shell_v1 { public: QWaylandLayerShellIntegration(); ~QWaylandLayerShellIntegration() override; - QWaylandXdgActivationV1 *activation() const { return m_xdgActivation.data(); } + QWaylandXdgActivationV1 *activation() const + { + return m_xdgActivation.data(); + } QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override; + private: QScopedPointer m_xdgActivation; }; diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index 228195a..16bc12e 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -184,14 +184,12 @@ bool QWaylandLayerSurface::requestActivate() return true; } else { const auto focusWindow = QGuiApplication::focusWindow(); - const auto wlWindow = focusWindow ? static_cast(focusWindow->handle()) : window(); + const auto wlWindow = focusWindow ? static_cast(focusWindow->handle()) : window(); if (const auto seat = wlWindow->display()->lastInputDevice()) { - const auto tokenProvider = activation->requestXdgActivationToken( - wlWindow->display(), wlWindow->wlSurface(), 0, QString()); - connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, - [this](const QString &token) { - m_shell->activation()->activate(token, window()->wlSurface()); - }); + const auto tokenProvider = activation->requestXdgActivationToken(wlWindow->display(), wlWindow->wlSurface(), 0, QString()); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, [this](const QString &token) { + m_shell->activation()->activate(token, window()->wlSurface()); + }); connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); return true; } @@ -210,13 +208,11 @@ void QWaylandLayerSurface::requestXdgActivationToken(quint32 serial) if (!activation->isActive()) { return; } - auto tokenProvider = activation->requestXdgActivationToken( - window()->display(), window()->wlSurface(), serial, QString()); + auto tokenProvider = activation->requestXdgActivationToken(window()->display(), window()->wlSurface(), serial, QString()); - connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, - [this](const QString &token) { - Q_EMIT window()->xdgActivationTokenCreated(token); - }); + connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, [this](const QString &token) { + Q_EMIT window()->xdgActivationTokenCreated(token); + }); connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); } @@ -230,4 +226,3 @@ void QWaylandLayerSurface::sendExpose() } } -