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

@ -109,9 +109,9 @@ void TestDragAndDrop::init()
m_registry->setup();
QVERIFY(interfacesAnnouncedSpy.wait());
#define CREATE(variable, factory, iface) \
variable = \
m_registry->create##factory(m_registry->interface(Registry::Interface::iface).name, m_registry->interface(Registry::Interface::iface).version, this); \
#define CREATE(variable, factory, iface) \
variable = \
m_registry->create##factory(m_registry->interface(Registry::Interface::iface).name, m_registry->interface(Registry::Interface::iface).version, this); \
QVERIFY(variable);
CREATE(m_compositor, Compositor, Compositor)
@ -137,10 +137,10 @@ void TestDragAndDrop::init()
void TestDragAndDrop::cleanup()
{
#define DELETE(name) \
if (name) { \
delete name; \
name = nullptr; \
#define DELETE(name) \
if (name) { \
delete name; \
name = nullptr; \
}
DELETE(m_dataSource)
DELETE(m_dataDevice)

View file

@ -93,10 +93,10 @@ void ErrorTest::init()
void ErrorTest::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_plasmaShell)
CLEANUP(m_compositor)

View file

@ -101,10 +101,10 @@ void FakeInputTest::init()
void FakeInputTest::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_fakeInput)
CLEANUP(m_queue)

View file

@ -90,10 +90,10 @@ void IdleTest::init()
void IdleTest::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_idle)
CLEANUP(m_seat)

View file

@ -120,10 +120,10 @@ void TestActivities::init()
void TestActivities::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_compositor)
CLEANUP(m_windowInterface)

View file

@ -144,10 +144,10 @@ void TestVirtualDesktop::init()
void TestVirtualDesktop::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_compositor)
CLEANUP(m_plasmaVirtualDesktopManagement)

View file

@ -96,9 +96,9 @@ void TestPlasmaShell::init()
m_registry->setup();
QVERIFY(interfacesAnnouncedSpy.wait());
#define CREATE(variable, factory, iface) \
variable = \
m_registry->create##factory(m_registry->interface(Registry::Interface::iface).name, m_registry->interface(Registry::Interface::iface).version, this); \
#define CREATE(variable, factory, iface) \
variable = \
m_registry->create##factory(m_registry->interface(Registry::Interface::iface).name, m_registry->interface(Registry::Interface::iface).version, this); \
QVERIFY(variable);
CREATE(m_compositor, Compositor, Compositor)
@ -109,10 +109,10 @@ void TestPlasmaShell::init()
void TestPlasmaShell::cleanup()
{
#define DELETE(name) \
if (name) { \
delete name; \
name = nullptr; \
#define DELETE(name) \
if (name) { \
delete name; \
name = nullptr; \
}
DELETE(m_plasmaShell)
DELETE(m_compositor)

View file

@ -122,10 +122,10 @@ void TestPointerConstraints::init()
void TestPointerConstraints::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_compositor)
CLEANUP(m_pointerConstraints)

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;
@ -153,8 +154,8 @@ void SelectionTest::cleanup()
{
cleanupConnection(&m_client1);
cleanupConnection(&m_client2);
#define CLEANUP(variable) \
delete variable; \
#define CLEANUP(variable) \
delete variable; \
variable = nullptr;
CLEANUP(m_display)

View file

@ -109,10 +109,10 @@ void TestServerSideDecorationPalette::init()
void TestServerSideDecorationPalette::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_compositor)
CLEANUP(m_paletteManager)

View file

@ -96,10 +96,10 @@ void ShadowTest::init()
void ShadowTest::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_shm)
CLEANUP(m_compositor)

View file

@ -127,10 +127,10 @@ void TextInputTest::init()
void TextInputTest::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_textInputManagerV2)
CLEANUP(m_keyboard)

View file

@ -111,10 +111,10 @@ void TestAppmenu::init()
void TestAppmenu::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_compositor)
CLEANUP(m_appmenuManager)

View file

@ -107,10 +107,10 @@ void TestBlur::init()
void TestBlur::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_compositor)
CLEANUP(m_blurManager)

View file

@ -110,10 +110,10 @@ void TestContrast::init()
void TestContrast::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_compositor)
CLEANUP(m_contrastManager)

View file

@ -1092,15 +1092,15 @@ class PointerHoldGesture : public QObject, public QtWayland::zwp_pointer_gesture
Q_OBJECT
void zwp_pointer_gesture_hold_v1_begin(uint32_t serial, uint32_t time, wl_surface *surface, uint32_t fingers) override
{
Q_EMIT started(serial, time, surface, fingers);
Q_EMIT started(serial, time, surface, fingers);
}
void zwp_pointer_gesture_hold_v1_end(uint32_t serial, uint32_t time, int32_t cancelled) override
{
cancelled ? Q_EMIT this->cancelled(serial, time) : Q_EMIT ended(serial, time);
cancelled ? Q_EMIT this->cancelled(serial, time) : Q_EMIT ended(serial, time);
}
Q_SIGNALS:
void started(quint32 serial , quint32 time, void *surface, quint32 fingers);
void started(quint32 serial, quint32 time, void *surface, quint32 fingers);
void ended(quint32 serial, quint32 time);
void cancelled(quint32 serial, quint32 time);
};
@ -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);
@ -1139,7 +1138,7 @@ void TestWaylandSeat::testPointerHoldGesture()
QVERIFY(surfaceCreatedSpy.isValid());
QScopedPointer<Surface> surface(m_compositor->createSurface());
QVERIFY(surfaceCreatedSpy.wait());
auto serverSurface = surfaceCreatedSpy.first().first().value<SurfaceInterface*>();
auto serverSurface = surfaceCreatedSpy.first().first().value<SurfaceInterface *>();
QVERIFY(serverSurface);
QImage image(QSize(100, 100), QImage::Format_ARGB32_Premultiplied);
@ -1162,7 +1161,7 @@ void TestWaylandSeat::testPointerHoldGesture()
QCOMPARE(startSpy.count(), 1);
QCOMPARE(startSpy.first().at(0).value<quint32>(), m_display->serial());
QCOMPARE(startSpy.first().at(1).value<quint32>(), 1u);
QCOMPARE(startSpy.first().at(2).value<void*>(), *surface.get());
QCOMPARE(startSpy.first().at(2).value<void *>(), *surface.get());
QCOMPARE(startSpy.first().at(3).value<quint32>(), 3);
// another start should not be possible

View file

@ -107,10 +107,10 @@ void TestSlide::init()
void TestSlide::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_compositor)
CLEANUP(m_slideManager)

View file

@ -140,10 +140,10 @@ void TestForeign::init()
void TestForeign::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_compositor)

View file

@ -75,14 +75,14 @@ private:
Seat *m_seat = nullptr;
};
#define SURFACE \
QSignalSpy xdgSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::toplevelCreated); \
QVERIFY(xdgSurfaceCreatedSpy.isValid()); \
QScopedPointer<Surface> surface(m_compositor->createSurface()); \
QScopedPointer<XdgShellSurface> xdgSurface(m_xdgShell->createSurface(surface.data())); \
QCOMPARE(xdgSurface->size(), QSize()); \
QVERIFY(xdgSurfaceCreatedSpy.wait()); \
auto serverXdgToplevel = xdgSurfaceCreatedSpy.first().first().value<XdgToplevelInterface *>(); \
#define SURFACE \
QSignalSpy xdgSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::toplevelCreated); \
QVERIFY(xdgSurfaceCreatedSpy.isValid()); \
QScopedPointer<Surface> surface(m_compositor->createSurface()); \
QScopedPointer<XdgShellSurface> xdgSurface(m_xdgShell->createSurface(surface.data())); \
QCOMPARE(xdgSurface->size(), QSize()); \
QVERIFY(xdgSurfaceCreatedSpy.wait()); \
auto serverXdgToplevel = xdgSurfaceCreatedSpy.first().first().value<XdgToplevelInterface *>(); \
QVERIFY(serverXdgToplevel);
void XdgShellTest::init()
@ -164,10 +164,10 @@ void XdgShellTest::init()
void XdgShellTest::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_xdgShell)
CLEANUP(m_compositor)

View file

@ -219,10 +219,10 @@ void DataControlInterfaceTest::init()
void DataControlInterfaceTest::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_dataControlDeviceManager)
CLEANUP(m_clientSeat)

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

@ -157,7 +157,7 @@ QList<OutputInterface *> Display::outputs() const
return d->outputs;
}
QList< OutputDeviceV2Interface* > Display::outputDevices() const
QList<OutputDeviceV2Interface *> Display::outputDevices() const
{
return d->outputdevicesV2;
}
@ -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

@ -111,7 +111,7 @@ public:
/**
* @returns All SeatInterface currently managed on the Display.
*/
QVector<SeatInterface*> seats() const;
QVector<SeatInterface *> seats() const;
QList<OutputDeviceV2Interface *> outputDevices() const;
QList<OutputInterface *> outputs() const;
QVector<OutputInterface *> outputsIntersecting(const QRect &rect) const;

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,
@ -186,7 +184,7 @@ DrmLeaseConnectorV1Interface::~DrmLeaseConnectorV1Interface()
DrmLeaseConnectorV1Interface *DrmLeaseConnectorV1Interface::get(wl_resource *resource)
{
if (auto connectorPrivate = resource_cast<DrmLeaseConnectorV1InterfacePrivate*>(resource)) {
if (auto connectorPrivate = resource_cast<DrmLeaseConnectorV1InterfacePrivate *>(resource)) {
return connectorPrivate->q;
}
return nullptr;
@ -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

@ -201,10 +201,10 @@ void KeyboardInterface::sendKey(quint32 key, KeyboardKeyState state)
void KeyboardInterface::sendModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group)
{
bool changed = false;
#define UPDATE(value) \
if (d->modifiers.value != value) { \
d->modifiers.value = value; \
changed = true; \
#define UPDATE(value) \
if (d->modifiers.value != value) { \
d->modifiers.value = value; \
changed = true; \
}
UPDATE(depressed)
UPDATE(latched)

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

@ -40,7 +40,7 @@ public:
* @returns @c true if the enabled property of the outputdevice has changed.
* bool modeChanged() const;
*/
/** Whether the transform() property of the outputdevice changed. */
/** Whether the transform() property of the outputdevice changed. */
bool transformChanged() const;
/** Whether the size property of the outputdevice changed.

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>
@ -56,7 +56,7 @@ protected:
void OutputConfigurationV2InterfacePrivate::kde_output_configuration_v2_enable(Resource *resource, wl_resource *outputdevice, int32_t enable)
{
Q_UNUSED(resource)
OutputDeviceV2Interface *output = OutputDeviceV2Interface::get(outputdevice);
pendingChanges(output)->d->enabled = enable == 1;
}
@ -76,23 +76,23 @@ void OutputConfigurationV2InterfacePrivate::kde_output_configuration_v2_transfor
Q_UNUSED(resource)
auto toTransform = [transform]() {
switch (transform) {
case WL_OUTPUT_TRANSFORM_90:
return OutputDeviceV2Interface::Transform::Rotated90;
case WL_OUTPUT_TRANSFORM_180:
return OutputDeviceV2Interface::Transform::Rotated180;
case WL_OUTPUT_TRANSFORM_270:
return OutputDeviceV2Interface::Transform::Rotated270;
case WL_OUTPUT_TRANSFORM_FLIPPED:
return OutputDeviceV2Interface::Transform::Flipped;
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
return OutputDeviceV2Interface::Transform::Flipped90;
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
return OutputDeviceV2Interface::Transform::Flipped180;
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
return OutputDeviceV2Interface::Transform::Flipped270;
case WL_OUTPUT_TRANSFORM_NORMAL:
default:
return OutputDeviceV2Interface::Transform::Normal;
case WL_OUTPUT_TRANSFORM_90:
return OutputDeviceV2Interface::Transform::Rotated90;
case WL_OUTPUT_TRANSFORM_180:
return OutputDeviceV2Interface::Transform::Rotated180;
case WL_OUTPUT_TRANSFORM_270:
return OutputDeviceV2Interface::Transform::Rotated270;
case WL_OUTPUT_TRANSFORM_FLIPPED:
return OutputDeviceV2Interface::Transform::Flipped;
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
return OutputDeviceV2Interface::Transform::Flipped90;
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
return OutputDeviceV2Interface::Transform::Flipped180;
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
return OutputDeviceV2Interface::Transform::Flipped270;
case WL_OUTPUT_TRANSFORM_NORMAL:
default:
return OutputDeviceV2Interface::Transform::Normal;
}
};
auto _transform = toTransform();
@ -118,7 +118,7 @@ void OutputConfigurationV2InterfacePrivate::kde_output_configuration_v2_scale(Re
return;
}
OutputDeviceV2Interface *output = OutputDeviceV2Interface::get(outputdevice);
pendingChanges(output)->d->scale = doubleScale;
}
@ -190,7 +190,7 @@ OutputConfigurationV2InterfacePrivate::OutputConfigurationV2InterfacePrivate(Out
{
}
QHash<OutputDeviceV2Interface*, OutputChangeSetV2*> OutputConfigurationV2Interface::changes() const
QHash<OutputDeviceV2Interface *, OutputChangeSetV2 *> OutputConfigurationV2Interface::changes() const
{
return d->changes;
}
@ -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*)
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;
@ -174,7 +178,7 @@ void OutputDeviceV2Interface::setCurrentMode(OutputDeviceModeV2Interface *mode)
}
if (d->currentMode) {
// another mode has the current flag - remove
d->currentMode->setFlags(d->currentMode->flags() & ~uint(OutputDeviceModeV2Interface::ModeFlag::Current));
d->currentMode->setFlags(d->currentMode->flags() & ~uint(OutputDeviceModeV2Interface::ModeFlag::Current));
}
mode->setFlags(mode->flags() | OutputDeviceModeV2Interface::ModeFlag::Current);
@ -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) {
return mode->size() == size && mode->refreshRate() == refreshRate;
}
);
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;
}
@ -296,14 +298,14 @@ void OutputDeviceV2InterfacePrivate::sendCurrentMode(Resource *outputResource)
void OutputDeviceV2InterfacePrivate::sendGeometry(Resource *resource)
{
send_geometry(resource->handle,
globalPosition.x(),
globalPosition.y(),
physicalSize.width(),
physicalSize.height(),
toSubPixel(),
manufacturer,
model,
toTransform());
globalPosition.x(),
globalPosition.y(),
physicalSize.width(),
physicalSize.height(),
toSubPixel(),
manufacturer,
model,
toTransform());
}
void OutputDeviceV2InterfacePrivate::sendScale(Resource *resource)
@ -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,
@ -146,7 +145,7 @@ private:
*
* Represents an output device mode.
*
* @see OutputDeviceV2Interface
* @see OutputDeviceV2Interface
*/
class KWAYLANDSERVER_EXPORT OutputDeviceModeV2Interface : public QObject
{

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,
@ -145,15 +146,15 @@ protected:
void ShadowInterfacePrivate::org_kde_kwin_shadow_commit(Resource *resource)
{
Q_UNUSED(resource)
#define BUFFER(__FLAG__, __PART__) \
if (pending.flags & State::Flags::__FLAG__##Buffer) { \
if (current.__PART__) { \
current.__PART__->unref(); \
} \
if (pending.__PART__) { \
pending.__PART__->ref(); \
} \
current.__PART__ = pending.__PART__; \
#define BUFFER(__FLAG__, __PART__) \
if (pending.flags & State::Flags::__FLAG__##Buffer) { \
if (current.__PART__) { \
current.__PART__->unref(); \
} \
if (pending.__PART__) { \
pending.__PART__->ref(); \
} \
current.__PART__ = pending.__PART__; \
}
BUFFER(Left, left)
BUFFER(TopLeft, topLeft)
@ -301,9 +302,9 @@ ShadowInterfacePrivate::ShadowInterfacePrivate(ShadowInterface *_q, wl_resource
ShadowInterfacePrivate::~ShadowInterfacePrivate()
{
#define CURRENT(__PART__) \
if (current.__PART__) { \
current.__PART__->unref(); \
#define CURRENT(__PART__) \
if (current.__PART__) { \
current.__PART__->unref(); \
}
CURRENT(left)
CURRENT(topLeft)
@ -330,10 +331,10 @@ QMarginsF ShadowInterface::offset() const
return d->current.offset;
}
#define BUFFER(__PART__) \
ClientBuffer *ShadowInterface::__PART__() const \
{ \
return d->current.__PART__; \
#define BUFFER(__PART__) \
ClientBuffer *ShadowInterface::__PART__() const \
{ \
return d->current.__PART__; \
}
BUFFER(left)

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;
};