Run clang-format

This commit is contained in:
Nicolas Fella 2024-04-21 17:50:57 +02:00
parent 2ac46d8d9d
commit 80a047c0db
4 changed files with 19 additions and 19 deletions

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/ */
#include <QQmlExtensionPlugin>
#include "../interfaces/window.h" #include "../interfaces/window.h"
#include <QQmlExtensionPlugin>
#include <qqml.h> #include <qqml.h>
QML_DECLARE_TYPEINFO(LayerShellQt::Window, QML_HAS_ATTACHED_PROPERTIES) 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_PLUGIN_METADATA(IID "org.kde.layershellqt")
Q_OBJECT Q_OBJECT
public: public:
void registerTypes(const char *uri) override { void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.layershell")); Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.layershell"));
qmlRegisterType<LayerShellQt::Window>(uri, 1, 0, "Window"); qmlRegisterType<LayerShellQt::Window>(uri, 1, 0, "Window");
} }

View File

@ -32,5 +32,4 @@ QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::createShel
return new QWaylandLayerSurface(this, window); return new QWaylandLayerSurface(this, window);
} }
} }

View File

@ -18,14 +18,19 @@ class QWaylandXdgActivationV1;
namespace LayerShellQt namespace LayerShellQt
{ {
class LAYERSHELLQT_EXPORT QWaylandLayerShellIntegration : public QtWaylandClient::QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>, public QtWayland::zwlr_layer_shell_v1 class LAYERSHELLQT_EXPORT QWaylandLayerShellIntegration : public QtWaylandClient::QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>,
public QtWayland::zwlr_layer_shell_v1
{ {
public: public:
QWaylandLayerShellIntegration(); QWaylandLayerShellIntegration();
~QWaylandLayerShellIntegration() override; ~QWaylandLayerShellIntegration() override;
QWaylandXdgActivationV1 *activation() const { return m_xdgActivation.data(); } QWaylandXdgActivationV1 *activation() const
{
return m_xdgActivation.data();
}
QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override; QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override;
private: private:
QScopedPointer<QWaylandXdgActivationV1> m_xdgActivation; QScopedPointer<QWaylandXdgActivationV1> m_xdgActivation;
}; };

View File

@ -184,12 +184,10 @@ bool QWaylandLayerSurface::requestActivate()
return true; return true;
} else { } else {
const auto focusWindow = QGuiApplication::focusWindow(); const auto focusWindow = QGuiApplication::focusWindow();
const auto wlWindow = focusWindow ? static_cast<QtWaylandClient::QWaylandWindow*>(focusWindow->handle()) : window(); const auto wlWindow = focusWindow ? static_cast<QtWaylandClient::QWaylandWindow *>(focusWindow->handle()) : window();
if (const auto seat = wlWindow->display()->lastInputDevice()) { if (const auto seat = wlWindow->display()->lastInputDevice()) {
const auto tokenProvider = activation->requestXdgActivationToken( const auto tokenProvider = activation->requestXdgActivationToken(wlWindow->display(), wlWindow->wlSurface(), 0, QString());
wlWindow->display(), wlWindow->wlSurface(), 0, QString()); connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, [this](const QString &token) {
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this,
[this](const QString &token) {
m_shell->activation()->activate(token, window()->wlSurface()); m_shell->activation()->activate(token, window()->wlSurface());
}); });
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater);
@ -210,11 +208,9 @@ void QWaylandLayerSurface::requestXdgActivationToken(quint32 serial)
if (!activation->isActive()) { if (!activation->isActive()) {
return; return;
} }
auto tokenProvider = activation->requestXdgActivationToken( auto tokenProvider = activation->requestXdgActivationToken(window()->display(), window()->wlSurface(), serial, QString());
window()->display(), window()->wlSurface(), serial, QString());
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, [this](const QString &token) {
[this](const QString &token) {
Q_EMIT window()->xdgActivationTokenCreated(token); Q_EMIT window()->xdgActivationTokenCreated(token);
}); });
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater);
@ -230,4 +226,3 @@ void QWaylandLayerSurface::sendExpose()
} }
} }