Address code formatting

This commit is contained in:
Aleix Pol 2021-04-06 13:39:27 +02:00
parent 1bf7276d53
commit cd9b1a6fd3
12 changed files with 80 additions and 90 deletions

View file

@ -23,11 +23,11 @@ include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(CheckIncludeFiles)
include(CMakePackageConfigHelpers)
include(FeatureSummary)
include(GenerateExportHeader)
include(KDEClangFormat)
include(ECMQtDeclareLoggingCategory)
find_package(WaylandScanner)
find_package(QtWaylandScanner)
@ -36,7 +36,6 @@ find_package(WaylandProtocols)
set_package_properties(Wayland PROPERTIES
TYPE REQUIRED)
# adjusting CMAKE_C_FLAGS to get wayland protocols to compile
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90")
ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX LAYERSHELLQT
@ -44,7 +43,8 @@ ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX LAYERSHELLQT
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LayerShellQtConfigVersion.cmake"
SOVERSION 5)
include(ECMQtDeclareLoggingCategory)
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
add_subdirectory(src)
add_subdirectory(tests)

View file

@ -5,8 +5,8 @@
*/
#include "shell.h"
#include <qglobal.h>
#include <QByteArray>
#include <qglobal.h>
using namespace LayerShellQt;

View file

@ -11,11 +11,11 @@
namespace LayerShellQt
{
/**
* Sets the right environment so the shells created from now on use wlr-layer-shell.
*/
class LAYERSHELLQT_EXPORT Shell {
class LAYERSHELLQT_EXPORT Shell
{
public:
static void useLayerShell();
};

View file

@ -5,10 +5,10 @@
*/
#include "window.h"
#include <private/qwaylandwindow_p.h>
#include <private/qwaylandshellsurface_p.h>
#include <layershellqt_logging.h>
#include "../qwaylandlayersurface_p.h"
#include <layershellqt_logging.h>
#include <private/qwaylandshellsurface_p.h>
#include <private/qwaylandwindow_p.h>
using namespace LayerShellQt;
@ -47,7 +47,8 @@ void Window::setKeyboardInteractivity(bool enabled)
Window::Window(WindowPrivate *d)
: d(d)
{}
{
}
Window *Window::get(QWindow *window)
{

View file

@ -10,8 +10,8 @@
#include <qwayland-wlr-layer-shell-unstable-v1.h>
namespace LayerShellQt {
namespace LayerShellQt
{
QWaylandLayerShell::QWaylandLayerShell(QtWayland::zwlr_layer_shell_v1 *shell)
: QtWayland::zwlr_layer_shell_v1(shell->object())
{
@ -22,8 +22,7 @@ QWaylandLayerShell::~QWaylandLayerShell()
zwlr_layer_shell_v1_destroy(object());
}
QWaylandLayerSurface *QWaylandLayerShell::createLayerSurface(
QtWaylandClient::QWaylandWindow *window)
QWaylandLayerSurface *QWaylandLayerShell::createLayerSurface(QtWaylandClient::QWaylandWindow *window)
{
return new QWaylandLayerSurface(this, window);
}

View file

@ -10,21 +10,20 @@
#include <wayland-client.h>
#include <qwayland-wlr-layer-shell-unstable-v1.h>
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
#include <qwayland-wlr-layer-shell-unstable-v1.h>
#include "qwaylandlayersurface_p.h"
namespace LayerShellQt {
namespace LayerShellQt
{
class LAYERSHELLQT_EXPORT QWaylandLayerShell : public QtWayland::zwlr_layer_shell_v1
{
public:
QWaylandLayerShell(QtWayland::zwlr_layer_shell_v1 *shell);
virtual ~QWaylandLayerShell();
QWaylandLayerSurface *createLayerSurface(
QtWaylandClient::QWaylandWindow *window);
QWaylandLayerSurface *createLayerSurface(QtWaylandClient::QWaylandWindow *window);
// TODO: Popups
};

View file

@ -5,17 +5,17 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
#include "qwaylandlayershellintegration_p.h"
#include "qwaylandlayershell_p.h"
#include "qwaylandlayershellintegration_p.h"
#include <qwayland-wlr-layer-shell-unstable-v1.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <qwayland-wlr-layer-shell-unstable-v1.h>
namespace LayerShellQt {
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration() :
m_layerShell(Q_NULLPTR)
namespace LayerShellQt
{
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
: m_layerShell(Q_NULLPTR)
{
}
@ -26,22 +26,17 @@ bool QWaylandLayerShellIntegration::initialize(QtWaylandClient::QWaylandDisplay
return m_layerShell != nullptr;
}
QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::
createShellSurface(QtWaylandClient::QWaylandWindow *window)
QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::createShellSurface(QtWaylandClient::QWaylandWindow *window)
{
return m_layerShell->createLayerSurface(window);
}
void QWaylandLayerShellIntegration::registryLayer(void *data,
struct wl_registry *registry, uint32_t id,
const QString &interface, uint32_t version)
void QWaylandLayerShellIntegration::registryLayer(void *data, struct wl_registry *registry, uint32_t id, const QString &interface, uint32_t version)
{
QWaylandLayerShellIntegration *shell =
static_cast<QWaylandLayerShellIntegration *>(data);
QWaylandLayerShellIntegration *shell = static_cast<QWaylandLayerShellIntegration *>(data);
if (interface == QStringLiteral("zwlr_layer_shell_v1"))
shell->m_layerShell = new QWaylandLayerShell(
new QtWayland::zwlr_layer_shell_v1(registry, id, version));
shell->m_layerShell = new QWaylandLayerShell(new QtWayland::zwlr_layer_shell_v1(registry, id, version));
}
}

View file

@ -10,11 +10,11 @@
#include <wayland-client.h>
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
#include "layershellqt_export.h"
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
namespace LayerShellQt {
namespace LayerShellQt
{
class QWaylandLayerShell;
class LAYERSHELLQT_EXPORT QWaylandLayerShellIntegration : public QtWaylandClient::QWaylandShellIntegration
@ -23,12 +23,10 @@ public:
QWaylandLayerShellIntegration();
bool initialize(QtWaylandClient::QWaylandDisplay *display) override;
QtWaylandClient::QWaylandShellSurface *createShellSurface(
QtWaylandClient::QWaylandWindow *window) override;
QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override;
private:
static void registryLayer(void *data, struct wl_registry *registry,
uint32_t id, const QString &interface, uint32_t version);
static void registryLayer(void *data, struct wl_registry *registry, uint32_t id, const QString &interface, uint32_t version);
QWaylandLayerShell *m_layerShell;
};

View file

@ -5,24 +5,23 @@
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
#include "qwaylandlayershellintegration_p.h"
#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
using namespace LayerShellQt;
class QWaylandLayerShellIntegrationPlugin :
public QtWaylandClient::QWaylandShellIntegrationPlugin
class QWaylandLayerShellIntegrationPlugin : public QtWaylandClient::QWaylandShellIntegrationPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(
IID QWaylandShellIntegrationFactoryInterface_iid
FILE "layer-shell.json")
Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "layer-shell.json")
public:
QWaylandLayerShellIntegrationPlugin() {}
QWaylandLayerShellIntegrationPlugin()
{
}
QtWaylandClient::QWaylandShellIntegration *create(
const QString &key, const QStringList &paramList) override {
QtWaylandClient::QWaylandShellIntegration *create(const QString &key, const QStringList &paramList) override
{
Q_UNUSED(key);
Q_UNUSED(paramList);
return new QWaylandLayerShellIntegration();

View file

@ -8,13 +8,13 @@
#include "qwaylandlayershell_p.h"
#include "qwaylandlayersurface_p.h"
#include <qwayland-wlr-layer-shell-unstable-v1.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylandsurface_p.h>
#include <QtWaylandClient/private/qwaylandscreen_p.h>
#include <QtWaylandClient/private/qwaylandsurface_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <qwayland-wlr-layer-shell-unstable-v1.h>
namespace LayerShellQt {
namespace LayerShellQt
{
QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShell *shell, QtWaylandClient::QWaylandWindow *window)
: QtWaylandClient::QWaylandShellSurface(window)
, QtWayland::zwlr_layer_surface_v1(
@ -37,8 +37,7 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
window()->window()->close();
}
void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial,
uint32_t width, uint32_t height)
void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height)
{
ack_configure(serial);
m_pendingSize = QSize(width, height);

View file

@ -10,24 +10,23 @@
#include <wayland-client.h>
#include <qwayland-wlr-layer-shell-unstable-v1.h>
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
#include "layershellqt_export.h"
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
#include <qwayland-wlr-layer-shell-unstable-v1.h>
namespace LayerShellQt {
namespace LayerShellQt
{
class QWaylandLayerShell;
class LAYERSHELLQT_EXPORT QWaylandLayerSurface : public QtWaylandClient::QWaylandShellSurface,
public QtWayland::zwlr_layer_surface_v1
class LAYERSHELLQT_EXPORT QWaylandLayerSurface : public QtWaylandClient::QWaylandShellSurface, public QtWayland::zwlr_layer_surface_v1
{
Q_OBJECT
public:
QWaylandLayerSurface(QWaylandLayerShell *shell,
QtWaylandClient::QWaylandWindow *window);
QWaylandLayerSurface(QWaylandLayerShell *shell, QtWaylandClient::QWaylandWindow *window);
virtual ~QWaylandLayerSurface();
bool isExposed() const override {
bool isExposed() const override
{
return m_configured;
}
@ -39,8 +38,7 @@ public:
void applyConfigure() override;
private:
void zwlr_layer_surface_v1_configure(uint32_t serial,
uint32_t width, uint32_t height) override;
void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override;
void zwlr_layer_surface_v1_closed() override;
QSize m_pendingSize;

View file

@ -15,7 +15,8 @@ int main(int argc, char** argv)
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.loadData("import QtQuick.Controls 2.10\n"
engine.loadData(
"import QtQuick.Controls 2.10\n"
"import QtQuick 2.10\n"
"\n"
"ApplicationWindow {"
@ -24,7 +25,8 @@ int main(int argc, char** argv)
" Rectangle { color: 'red'; anchors.fill: parent }"
"}"
, QStringLiteral("bananaland:/potato.qml"));
,
QStringLiteral("bananaland:/potato.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [](QObject *object) {
auto layerWindow = LayerShellQt::Window::get(qobject_cast<QWindow *>(object));