Run .clang-format

This commit is contained in:
Vlad Zahorodnii 2022-04-19 13:14:26 +03:00
parent 14ae6e3100
commit 227ab071be
50 changed files with 247 additions and 220 deletions

View file

@ -60,7 +60,8 @@ public:
/**
* Structure containing DBus service name and path
*/
struct InterfaceAddress {
struct InterfaceAddress
{
/** Service name of host with the AppMenu object*/
QString serviceName;
/** Object path of the AppMenu interface*/

View file

@ -39,7 +39,8 @@ private:
SeatInterface *m_seatInterface = nullptr;
DataDeviceManagerInterface *m_ddmInterface = nullptr;
struct Connection {
struct Connection
{
ConnectionThread *connection = nullptr;
QThread *thread = nullptr;
EventQueue *queue = nullptr;

View file

@ -1126,7 +1126,6 @@ void TestWaylandSeat::testPointerHoldGesture()
PointerHoldGesture gesture(gestures.get_hold_gesture(*pointer));
QVERIFY(gesture.isInitialized());
QSignalSpy startSpy(&gesture, &PointerHoldGesture::started);
QVERIFY(startSpy.isValid());
QSignalSpy endSpy(&gesture, &PointerHoldGesture::ended);

View file

@ -35,7 +35,8 @@ public:
QPointer<DataSourceInterface> selection;
QPointer<SurfaceInterface> proxyRemoteSurface;
struct Drag {
struct Drag
{
SurfaceInterface *surface = nullptr;
QMetaObject::Connection destroyConnection;
QMetaObject::Connection posConnection;

View file

@ -233,7 +233,8 @@ void *Display::eglDisplay() const
return d->eglDisplay;
}
struct ClientBufferDestroyListener : wl_listener {
struct ClientBufferDestroyListener : wl_listener
{
ClientBufferDestroyListener(Display *display, ClientBuffer *buffer);
~ClientBufferDestroyListener();

View file

@ -5,8 +5,8 @@
*/
#include "drmleasedevice_v1_interface.h"
#include "drmleasedevice_v1_interface_p.h"
#include "display.h"
#include "drmleasedevice_v1_interface_p.h"
#include "logging.h"
#include "utils.h"
@ -60,7 +60,6 @@ void DrmLeaseDeviceV1Interface::setDrmMaster(bool hasDrmMaster)
d->hasDrmMaster = hasDrmMaster;
}
DrmLeaseDeviceV1InterfacePrivate::DrmLeaseDeviceV1InterfacePrivate(Display *display, DrmLeaseDeviceV1Interface *device, std::function<int()> createNonMasterFd)
: QtWaylandServer::wp_drm_lease_device_v1(*display, s_version)
, q(device)
@ -165,7 +164,6 @@ void DrmLeaseDeviceV1InterfacePrivate::wp_drm_lease_device_v1_destroy_global()
delete this;
}
DrmLeaseConnectorV1Interface::DrmLeaseConnectorV1Interface(DrmLeaseDeviceV1Interface *leaseDevice,
uint32_t id,
const QString &name,
@ -239,7 +237,6 @@ void DrmLeaseConnectorV1InterfacePrivate::wp_drm_lease_connector_v1_destroy(Reso
wl_resource_destroy(resource->handle);
}
DrmLeaseRequestV1Interface::DrmLeaseRequestV1Interface(DrmLeaseDeviceV1InterfacePrivate *device, wl_resource *resource)
: wp_drm_lease_request_v1(resource)
, device(device)
@ -363,7 +360,6 @@ QVector<DrmLeaseConnectorV1Interface *> DrmLeaseV1Interface::connectors() const
return d->connectors;
}
DrmLeaseV1InterfacePrivate::DrmLeaseV1InterfacePrivate(DrmLeaseDeviceV1InterfacePrivate *device, DrmLeaseV1Interface *q, wl_resource *resource)
: wp_drm_lease_v1(resource)
, device(device)

View file

@ -40,6 +40,7 @@ public:
std::function<int()> createNonMasterFd;
bool hasDrmMaster = true;
bool removed = false;
protected:
void wp_drm_lease_device_v1_create_lease_request(Resource *resource, uint32_t id) override;
void wp_drm_lease_device_v1_release(Resource *resource) override;
@ -66,6 +67,7 @@ public:
QString name;
QString description;
bool withdrawn = false;
protected:
void wp_drm_lease_connector_v1_destroy(Resource *resource) override;
};
@ -79,6 +81,7 @@ public:
DrmLeaseDeviceV1InterfacePrivate *device;
QVector<DrmLeaseConnectorV1Interface *> connectors;
bool invalid = false;
protected:
void wp_drm_lease_request_v1_request_connector(Resource *resource, struct ::wl_resource *connector) override;
void wp_drm_lease_request_v1_submit(Resource *resource, uint32_t id) override;
@ -95,10 +98,10 @@ public:
QVector<DrmLeaseConnectorV1Interface *> connectors;
uint32_t lesseeId = 0;
bool finished = false;
protected:
void wp_drm_lease_v1_destroy(Resource *resource) override;
void wp_drm_lease_v1_destroy_resource(Resource *resource) override;
};
}

View file

@ -39,12 +39,14 @@ public:
QMetaObject::Connection destroyConnection;
QByteArray keymap;
struct {
struct
{
qint32 charactersPerSecond = 0;
qint32 delay = 0;
} keyRepeat;
struct Modifiers {
struct Modifiers
{
quint32 depressed = 0;
quint32 latched = 0;
quint32 locked = 0;

View file

@ -59,7 +59,12 @@ class KWAYLANDSERVER_EXPORT LayerSurfaceV1Interface : public QObject
Q_OBJECT
public:
enum Layer { BackgroundLayer, BottomLayer, TopLayer, OverlayLayer };
enum Layer {
BackgroundLayer,
BottomLayer,
TopLayer,
OverlayLayer,
};
LayerSurfaceV1Interface(LayerShellV1Interface *shell,
SurfaceInterface *surface,

View file

@ -16,8 +16,8 @@
#include "surface_interface_p.h"
#include <QTemporaryFile>
#include <fcntl.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
namespace KWaylandServer
@ -508,7 +508,8 @@ void LinuxDmaBufV1FeedbackPrivate::zwp_linux_dmabuf_feedback_v1_destroy(Resource
wl_resource_destroy(resource->handle);
}
struct linux_dmabuf_feedback_v1_table_entry {
struct linux_dmabuf_feedback_v1_table_entry
{
uint32_t format;
uint32_t pad; // unused
uint64_t modifier;

View file

@ -24,7 +24,8 @@ class LinuxDmaBufV1FeedbackPrivate;
/**
* The LinuxDmaBufV1Plane type represents a plane in a client buffer.
*/
struct LinuxDmaBufV1Plane {
struct LinuxDmaBufV1Plane
{
int fd = -1; ///< The dmabuf file descriptor
quint32 offset = 0; ///< The offset from the start of buffer
quint32 stride = 0; ///< The distance from the start of a row to the next row in bytes
@ -70,7 +71,8 @@ public:
};
Q_DECLARE_FLAGS(TrancheFlags, TrancheFlag)
struct Tranche {
struct Tranche
{
dev_t device;
TrancheFlags flags;
QHash<uint32_t, QVector<uint64_t>> formatTable;

View file

@ -40,7 +40,8 @@ public:
OutputInterface::SubPixel subPixel = OutputInterface::SubPixel::Unknown;
OutputInterface::Transform transform = OutputInterface::Transform::Normal;
OutputInterface::Mode mode;
struct {
struct
{
OutputInterface::DpmsMode mode = OutputInterface::DpmsMode::Off;
bool supported = false;
} dpms;

View file

@ -54,7 +54,8 @@ public:
Flipped180,
Flipped270,
};
struct Mode {
struct Mode
{
QSize size = QSize();
int refreshRate = 60000;
};

View file

@ -5,14 +5,14 @@
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "display.h"
#include "outputconfiguration_v2_interface.h"
#include "outputdevice_v2_interface.h"
#include "display.h"
#include "logging.h"
#include "outputchangeset_v2_p.h"
#include "outputdevice_v2_interface.h"
#include "qwayland-server-kde-output-management-v2.h"
#include "qwayland-server-kde-output-device-v2.h"
#include "qwayland-server-kde-output-management-v2.h"
#include <wayland-client-protocol.h>
@ -244,12 +244,7 @@ bool OutputConfigurationV2InterfacePrivate::hasPendingChanges(OutputDeviceV2Inte
return false;
}
auto c = *it;
return c->enabledChanged() ||
c->sizeChanged() ||
c->refreshRateChanged() ||
c->transformChanged() ||
c->positionChanged() ||
c->scaleChanged();
return c->enabledChanged() || c->sizeChanged() || c->refreshRateChanged() || c->transformChanged() || c->positionChanged() || c->scaleChanged();
}
void OutputConfigurationV2InterfacePrivate::clearPendingChanges()

View file

@ -6,9 +6,9 @@
*/
#pragma once
#include "outputmanagement_v2_interface.h"
#include "outputdevice_v2_interface.h"
#include "outputchangeset_v2.h"
#include "outputdevice_v2_interface.h"
#include "outputmanagement_v2_interface.h"
#include <KWaylandServer/kwaylandserver_export.h>
@ -88,7 +88,6 @@ private:
QScopedPointer<OutputConfigurationV2InterfacePrivate> d;
};
}
Q_DECLARE_METATYPE(KWaylandServer::OutputConfigurationV2Interface *)

View file

@ -6,14 +6,14 @@
*/
#include "outputdevice_v2_interface.h"
#include "display_p.h"
#include "display.h"
#include "display_p.h"
#include "logging.h"
#include "utils.h"
#include <QDebug>
#include <QString>
#include <QPointer>
#include <QString>
#include <wayland-client-protocol.h>
@ -84,7 +84,8 @@ protected:
class OutputDeviceModeV2InterfacePrivate : public QtWaylandServer::kde_output_device_mode_v2
{
public:
struct ModeResource : Resource {
struct ModeResource : Resource
{
OutputDeviceV2InterfacePrivate::Resource *output;
};
@ -96,7 +97,10 @@ public:
void bindResource(wl_resource *resource);
static OutputDeviceModeV2InterfacePrivate *get(OutputDeviceModeV2Interface *mode) { return mode->d.data(); }
static OutputDeviceModeV2InterfacePrivate *get(OutputDeviceModeV2Interface *mode)
{
return mode->d.data();
}
OutputDeviceModeV2Interface *q;
@ -191,11 +195,9 @@ void OutputDeviceV2Interface::setCurrentMode(OutputDeviceModeV2Interface *mode)
bool OutputDeviceV2Interface::setCurrentMode(const QSize &size, int refreshRate)
{
auto mode = std::find_if(d->modes.begin(), d->modes.end(),
[size, refreshRate](OutputDeviceModeV2Interface *mode) {
auto mode = std::find_if(d->modes.begin(), d->modes.end(), [size, refreshRate](OutputDeviceModeV2Interface *mode) {
return mode->size() == size && mode->refreshRate() == refreshRate;
}
);
});
if (mode == d->modes.end()) {
return false;
}
@ -692,12 +694,14 @@ OutputDeviceModeV2InterfacePrivate::OutputDeviceModeV2InterfacePrivate(OutputDev
, m_size(size)
, m_refreshRate(refreshRate)
, m_flags(flags)
{}
{
}
OutputDeviceModeV2Interface::OutputDeviceModeV2Interface(const QSize &size, int refreshRate, ModeFlags flags, QObject *parent)
: QObject(parent)
, d(new OutputDeviceModeV2InterfacePrivate(this, size, refreshRate, flags))
{}
{
}
OutputDeviceModeV2Interface::~OutputDeviceModeV2Interface() = default;

View file

@ -24,7 +24,6 @@ class OutputDeviceV2InterfacePrivate;
class OutputDeviceModeV2Interface;
class OutputDeviceModeV2InterfacePrivate;
/** @class OutputDeviceV2Interface
*
* Represents an output device, the difference to Output is that this output can be disabled,

View file

@ -4,12 +4,12 @@
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "display.h"
#include "outputmanagement_v2_interface.h"
#include "display.h"
#include "outputconfiguration_v2_interface.h"
#include <wayland-server.h>
#include "qwayland-server-kde-output-management-v2.h"
#include <wayland-server.h>
#include <QHash>

View file

@ -538,7 +538,6 @@ public:
*/
void startPointerHoldGesture(quint32 fingerCount);
/**
* The multi-finger hold gesture ended. This may happen when one or more fingers are lifted.
* @see startPointerHoldGesture

View file

@ -69,7 +69,8 @@ public:
AbstractDataSource *currentPrimarySelection = nullptr;
// Pointer related members
struct Pointer {
struct Pointer
{
enum class State {
Released,
Pressed,
@ -77,7 +78,8 @@ public:
QHash<quint32, quint32> buttonSerials;
QHash<quint32, State> buttonStates;
QPointF pos;
struct Focus {
struct Focus
{
SurfaceInterface *surface = nullptr;
QMetaObject::Connection destroyConnection;
QPointF offset = QPointF();
@ -91,8 +93,10 @@ public:
void updatePointerButtonState(quint32 button, Pointer::State state);
// Keyboard related members
struct Keyboard {
struct Focus {
struct Keyboard
{
struct Focus
{
SurfaceInterface *surface = nullptr;
QMetaObject::Connection destroyConnection;
quint32 serial = 0;
@ -104,8 +108,10 @@ public:
Keyboard globalKeyboard;
// Touch related members
struct Touch {
struct Focus {
struct Touch
{
struct Focus
{
SurfaceInterface *surface = nullptr;
QMetaObject::Connection destroyConnection;
QPointF offset = QPointF();
@ -117,7 +123,8 @@ public:
};
Touch globalTouch;
struct Drag {
struct Drag
{
enum class Mode {
None,
Pointer,

View file

@ -91,7 +91,8 @@ public:
ShadowInterfacePrivate(ShadowInterface *_q, wl_resource *resource);
~ShadowInterfacePrivate();
struct State {
struct State
{
enum Flags {
None = 0,
LeftBuffer = 1 << 0,

View file

@ -30,7 +30,8 @@ public:
bool hasAlphaChannel = false;
QImage savedData;
struct DestroyListener {
struct DestroyListener
{
wl_listener listener;
ShmClientBufferPrivate *receiver;
};

View file

@ -38,16 +38,13 @@ SurfaceInterfacePrivate::~SurfaceInterfacePrivate()
wl_resource *resource;
wl_resource *tmp;
wl_resource_for_each_safe(resource, tmp, &current.frameCallbacks)
{
wl_resource_for_each_safe (resource, tmp, &current.frameCallbacks) {
wl_resource_destroy(resource);
}
wl_resource_for_each_safe(resource, tmp, &pending.frameCallbacks)
{
wl_resource_for_each_safe (resource, tmp, &pending.frameCallbacks) {
wl_resource_destroy(resource);
}
wl_resource_for_each_safe(resource, tmp, &cached.frameCallbacks)
{
wl_resource_for_each_safe (resource, tmp, &cached.frameCallbacks) {
wl_resource_destroy(resource);
}
@ -368,8 +365,7 @@ void SurfaceInterface::frameRendered(quint32 msec)
wl_resource *resource;
wl_resource *tmp;
wl_resource_for_each_safe(resource, tmp, &d->current.frameCallbacks)
{
wl_resource_for_each_safe (resource, tmp, &d->current.frameCallbacks) {
wl_callback_send_done(resource, msec);
wl_resource_destroy(resource);
}

View file

@ -20,7 +20,8 @@ class IdleInhibitorV1Interface;
class SurfaceRole;
class ViewportInterface;
struct SurfaceState {
struct SurfaceState
{
void mergeInto(SurfaceState *target);
QRegion damage = QRegion();
@ -53,7 +54,8 @@ struct SurfaceState {
QList<SubSurfaceInterface *> below;
QList<SubSurfaceInterface *> above;
struct {
struct
{
QRectF sourceGeometry = QRectF();
QSize destinationSize = QSize();
bool sourceGeometryIsSet = false;

View file

@ -59,7 +59,8 @@ private:
PlasmaShell *m_plasmaShell = nullptr;
PlasmaShellSurface *m_plasmaShellSurface = nullptr;
PlasmaWindowManagement *m_windowManagement = nullptr;
struct {
struct
{
Surface *surface = nullptr;
ShellSurface *shellSurface = nullptr;
PlasmaShellSurface *plasmaSurface = nullptr;

View file

@ -63,7 +63,8 @@ public:
qint32 surroundingTextSelectionAnchor = 0;
TextInputChangeCause surroundingTextChangeCause = TextInputChangeCause::InputMethod;
struct {
struct
{
QRect cursorRectangle;
TextInputChangeCause surroundingTextChangeCause = TextInputChangeCause::InputMethod;
TextInputContentHints contentHints = TextInputContentHint::None;

View file

@ -18,7 +18,8 @@ struct wl_resource;
namespace KWaylandServer
{
template<typename T>
struct SafeGlobalDeleter {
struct SafeGlobalDeleter
{
static inline void cleanup(T *global)
{
if (global) {

View file

@ -61,7 +61,12 @@ class KWAYLANDSERVER_EXPORT XdgToplevelDecorationV1Interface : public QObject
Q_OBJECT
public:
enum class Mode { Undefined, None, Client, Server };
enum class Mode {
Undefined,
None,
Client,
Server,
};
Q_ENUM(Mode)
/**

View file

@ -83,7 +83,8 @@ protected:
void xdg_positioner_set_parent_configure(Resource *resource, uint32_t serial) override;
};
struct XdgSurfaceState {
struct XdgSurfaceState
{
QRect windowGeometry;
quint32 acknowledgedConfigure;
bool acknowledgedConfigureIsSet = false;
@ -139,7 +140,8 @@ public:
QString windowTitle;
QString windowClass;
struct State {
struct State
{
QSize minimumSize;
QSize maximumSize;
};