summaryrefslogtreecommitdiff
path: root/src/protocols
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-12-07 18:51:18 +0100
committerGitHub <noreply@github.com>2024-12-07 18:51:18 +0100
commit8bbeee11734d3ba8e2cf15d19cb3c302f8bfdbf2 (patch)
tree5b6654818049a0743f62defc090e86d4327cccbb /src/protocols
parentb1e5cc66bdb20b002c93479490c3a317552210b3 (diff)
core: Add clang-tidy (#8664)
This adds a .clang-tidy file for us. It's not a strict requirement to be compliant, but I tuned it to be alright.
Diffstat (limited to 'src/protocols')
-rw-r--r--src/protocols/DataDeviceWlr.cpp4
-rw-r--r--src/protocols/LayerShell.hpp2
-rw-r--r--src/protocols/LinuxDMABUF.cpp6
-rw-r--r--src/protocols/OutputManagement.cpp6
-rw-r--r--src/protocols/PointerConstraints.cpp4
-rw-r--r--src/protocols/PointerConstraints.hpp1
-rw-r--r--src/protocols/PrimarySelection.cpp4
-rw-r--r--src/protocols/Screencopy.cpp12
-rw-r--r--src/protocols/SecurityContext.cpp4
-rw-r--r--src/protocols/SecurityContext.hpp6
-rw-r--r--src/protocols/Tablet.cpp12
-rw-r--r--src/protocols/TextInputV1.cpp10
-rw-r--r--src/protocols/ToplevelExport.cpp8
-rw-r--r--src/protocols/ToplevelExport.hpp1
-rw-r--r--src/protocols/WaylandProtocol.cpp8
-rw-r--r--src/protocols/WaylandProtocol.hpp12
-rw-r--r--src/protocols/XDGDialog.cpp2
-rw-r--r--src/protocols/XDGShell.cpp4
-rw-r--r--src/protocols/XWaylandShell.cpp2
-rw-r--r--src/protocols/core/DataDevice.cpp4
-rw-r--r--src/protocols/core/Seat.cpp6
-rw-r--r--src/protocols/core/Shm.cpp12
-rw-r--r--src/protocols/types/DMABuffer.cpp2
-rw-r--r--src/protocols/types/DataDevice.hpp6
-rw-r--r--src/protocols/types/SurfaceRole.hpp2
25 files changed, 69 insertions, 71 deletions
diff --git a/src/protocols/DataDeviceWlr.cpp b/src/protocols/DataDeviceWlr.cpp
index baf0a299..d8103d11 100644
--- a/src/protocols/DataDeviceWlr.cpp
+++ b/src/protocols/DataDeviceWlr.cpp
@@ -57,7 +57,7 @@ CWLRDataSource::CWLRDataSource(SP<CZwlrDataControlSourceV1> resource_, SP<CWLRDa
PROTO::dataWlr->destroyResource(this);
});
- resource->setOffer([this](CZwlrDataControlSourceV1* r, const char* mime) { mimeTypes.push_back(mime); });
+ resource->setOffer([this](CZwlrDataControlSourceV1* r, const char* mime) { mimeTypes.emplace_back(mime); });
}
CWLRDataSource::~CWLRDataSource() {
@@ -219,7 +219,7 @@ CWLRDataControlManagerResource::CWLRDataControlManagerResource(SP<CZwlrDataContr
RESOURCE->self = RESOURCE;
- sources.push_back(RESOURCE);
+ sources.emplace_back(RESOURCE);
LOGM(LOG, "New wlr data source bound at {:x}", (uintptr_t)RESOURCE.get());
});
diff --git a/src/protocols/LayerShell.hpp b/src/protocols/LayerShell.hpp
index ad6c1a75..5e74c91b 100644
--- a/src/protocols/LayerShell.hpp
+++ b/src/protocols/LayerShell.hpp
@@ -33,7 +33,7 @@ class CLayerShellResource {
void configure(const Vector2D& size);
void sendClosed();
- enum eCommittedState {
+ enum eCommittedState : uint8_t {
STATE_SIZE = (1 << 0),
STATE_ANCHOR = (1 << 1),
STATE_EXCLUSIVE = (1 << 2),
diff --git a/src/protocols/LinuxDMABUF.cpp b/src/protocols/LinuxDMABUF.cpp
index 7b2bcbf4..24b8f62c 100644
--- a/src/protocols/LinuxDMABUF.cpp
+++ b/src/protocols/LinuxDMABUF.cpp
@@ -219,7 +219,7 @@ void CLinuxDMABBUFParamsResource::create(uint32_t id) {
return;
}
- LOGM(LOG, "Creating a dmabuf, with id {}: size {}, fmt {}, planes {}", id, attrs->size, FormatUtils::drmFormatName(attrs->format), attrs->planes);
+ LOGM(LOG, "Creating a dmabuf, with id {}: size {}, fmt {}, planes {}", id, attrs->size, NFormatUtils::drmFormatName(attrs->format), attrs->planes);
for (int i = 0; i < attrs->planes; ++i) {
LOGM(LOG, " | plane {}: mod {} fd {} stride {} offset {}", i, attrs->modifier, attrs->fds[i], attrs->strides[i], attrs->offsets[i]);
}
@@ -448,7 +448,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
.formats = mon->output->getRenderFormats(),
};
- tches.push_back(std::make_pair<>(mon, tranche));
+ tches.emplace_back(std::make_pair<>(mon, tranche));
}
static auto monitorAdded = g_pHookSystem->hookDynamic("monitorAdded", [this](void* self, SCallbackInfo& info, std::any param) {
@@ -458,7 +458,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
.formats = pMonitor->output->getRenderFormats(),
};
- formatTable->monitorTranches.push_back(std::make_pair<>(pMonitor, tranche));
+ formatTable->monitorTranches.emplace_back(std::make_pair<>(pMonitor, tranche));
resetFormatTable();
});
diff --git a/src/protocols/OutputManagement.cpp b/src/protocols/OutputManagement.cpp
index 0c6a3348..4f7d48c4 100644
--- a/src/protocols/OutputManagement.cpp
+++ b/src/protocols/OutputManagement.cpp
@@ -57,7 +57,7 @@ void COutputManager::makeAndSendNewHead(PHLMONITOR pMonitor) {
return;
}
- heads.push_back(RESOURCE);
+ heads.emplace_back(RESOURCE);
resource->sendHead(RESOURCE->resource.get());
RESOURCE->sendAllData();
@@ -216,7 +216,7 @@ void COutputHead::makeAndSendNewMode(SP<Aquamarine::SOutputMode> mode) {
return;
}
- modes.push_back(RESOURCE);
+ modes.emplace_back(RESOURCE);
resource->sendMode(RESOURCE->resource.get());
RESOURCE->sendAllData();
}
@@ -285,7 +285,7 @@ COutputConfiguration::COutputConfiguration(SP<CZwlrOutputConfigurationV1> resour
return;
}
- heads.push_back(RESOURCE);
+ heads.emplace_back(RESOURCE);
LOGM(LOG, "enableHead on {}. For now, doing nothing. Waiting for apply().", PMONITOR->szName);
});
diff --git a/src/protocols/PointerConstraints.cpp b/src/protocols/PointerConstraints.cpp
index 7f08a7df..0a787414 100644
--- a/src/protocols/PointerConstraints.cpp
+++ b/src/protocols/PointerConstraints.cpp
@@ -45,7 +45,7 @@ CPointerConstraint::CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWL
}
CPointerConstraint::CPointerConstraint(SP<CZwpConfinedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region_, zwpPointerConstraintsV1Lifetime lifetime_) :
- resourceC(resource_), locked(false), lifetime(lifetime_) {
+ resourceC(resource_), lifetime(lifetime_) {
if (!resource_->resource())
return;
@@ -240,7 +240,7 @@ void CPointerConstraintsProtocol::onNewConstraint(SP<CPointerConstraint> constra
OWNER->appendConstraint(constraint);
- g_pInputManager->m_vConstraints.push_back(constraint);
+ g_pInputManager->m_vConstraints.emplace_back(constraint);
}
void CPointerConstraintsProtocol::onLockPointer(CZwpPointerConstraintsV1* pMgr, uint32_t id, wl_resource* surface, wl_resource* pointer, wl_resource* region,
diff --git a/src/protocols/PointerConstraints.hpp b/src/protocols/PointerConstraints.hpp
index 35d60632..964bf672 100644
--- a/src/protocols/PointerConstraints.hpp
+++ b/src/protocols/PointerConstraints.hpp
@@ -8,7 +8,6 @@
#include "WaylandProtocol.hpp"
#include "pointer-constraints-unstable-v1.hpp"
#include "../helpers/math/Math.hpp"
-#include "../helpers/math/Math.hpp"
#include "../helpers/signal/Signal.hpp"
class CWLSurface;
diff --git a/src/protocols/PrimarySelection.cpp b/src/protocols/PrimarySelection.cpp
index 7602a466..ecc4ee71 100644
--- a/src/protocols/PrimarySelection.cpp
+++ b/src/protocols/PrimarySelection.cpp
@@ -58,7 +58,7 @@ CPrimarySelectionSource::CPrimarySelectionSource(SP<CZwpPrimarySelectionSourceV1
PROTO::primarySelection->destroyResource(this);
});
- resource->setOffer([this](CZwpPrimarySelectionSourceV1* r, const char* mime) { mimeTypes.push_back(mime); });
+ resource->setOffer([this](CZwpPrimarySelectionSourceV1* r, const char* mime) { mimeTypes.emplace_back(mime); });
}
CPrimarySelectionSource::~CPrimarySelectionSource() {
@@ -203,7 +203,7 @@ CPrimarySelectionManager::CPrimarySelectionManager(SP<CZwpPrimarySelectionDevice
RESOURCE->self = RESOURCE;
- sources.push_back(RESOURCE);
+ sources.emplace_back(RESOURCE);
LOGM(LOG, "New primary selection data source bound at {:x}", (uintptr_t)RESOURCE.get());
});
diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp
index a7e515cb..898a1d6b 100644
--- a/src/protocols/Screencopy.cpp
+++ b/src/protocols/Screencopy.cpp
@@ -50,7 +50,7 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t
if (shmFormat == DRM_FORMAT_XRGB2101010 || shmFormat == DRM_FORMAT_ARGB2101010)
shmFormat = DRM_FORMAT_XBGR2101010;
- const auto PSHMINFO = FormatUtils::getPixelFormatFromDRM(shmFormat);
+ const auto PSHMINFO = NFormatUtils::getPixelFormatFromDRM(shmFormat);
if (!PSHMINFO) {
LOGM(ERR, "No pixel format supported by renderer in capture output");
resource->sendFailed();
@@ -68,9 +68,9 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t
box.transform(wlTransformToHyprutils(pMonitor->transform), pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y).scale(pMonitor->scale).round();
- shmStride = FormatUtils::minStride(PSHMINFO, box.w);
+ shmStride = NFormatUtils::minStride(PSHMINFO, box.w);
- resource->sendBuffer(FormatUtils::drmToShm(shmFormat), box.width, box.height, shmStride);
+ resource->sendBuffer(NFormatUtils::drmToShm(shmFormat), box.width, box.height, shmStride);
if (resource->version() >= 3) {
if (dmabufFormat != DRM_FORMAT_INVALID) {
@@ -258,7 +258,7 @@ bool CScreencopyFrame::copyShm() {
glBindFramebuffer(GL_FRAMEBUFFER, fb.getFBID());
#endif
- const auto PFORMAT = FormatUtils::getPixelFormatFromDRM(shm.format);
+ const auto PFORMAT = NFormatUtils::getPixelFormatFromDRM(shm.format);
if (!PFORMAT) {
LOGM(ERR, "Can't copy: failed to find a pixel format");
g_pHyprRenderer->endRender();
@@ -276,8 +276,8 @@ bool CScreencopyFrame::copyShm() {
glPixelStorei(GL_PACK_ALIGNMENT, 1);
- const auto drmFmt = FormatUtils::getPixelFormatFromDRM(shm.format);
- uint32_t packStride = FormatUtils::minStride(drmFmt, box.w);
+ const auto drmFmt = NFormatUtils::getPixelFormatFromDRM(shm.format);
+ uint32_t packStride = NFormatUtils::minStride(drmFmt, box.w);
if (packStride == (uint32_t)shm.stride) {
glReadPixels(0, 0, box.w, box.h, glFormat, PFORMAT->glType, pixelData);
diff --git a/src/protocols/SecurityContext.cpp b/src/protocols/SecurityContext.cpp
index 13428b91..0818907f 100644
--- a/src/protocols/SecurityContext.cpp
+++ b/src/protocols/SecurityContext.cpp
@@ -22,8 +22,8 @@ SP<CSecurityContextSandboxedClient> CSecurityContextSandboxedClient::create(int
}
static void onSecurityContextClientDestroy(wl_listener* l, void* d) {
- CSecurityContextSandboxedClientDestroyWrapper* wrap = wl_container_of(l, wrap, listener);
- CSecurityContextSandboxedClient* client = wrap->parent;
+ SCSecurityContextSandboxedClientDestroyWrapper* wrap = wl_container_of(l, wrap, listener);
+ CSecurityContextSandboxedClient* client = wrap->parent;
client->onDestroy();
}
diff --git a/src/protocols/SecurityContext.hpp b/src/protocols/SecurityContext.hpp
index 63f58bde..d675d660 100644
--- a/src/protocols/SecurityContext.hpp
+++ b/src/protocols/SecurityContext.hpp
@@ -38,7 +38,7 @@ class CSecurityContextManagerResource {
};
class CSecurityContextSandboxedClient;
-struct CSecurityContextSandboxedClientDestroyWrapper {
+struct SCSecurityContextSandboxedClientDestroyWrapper {
wl_listener listener;
CSecurityContextSandboxedClient* parent = nullptr;
};
@@ -48,9 +48,9 @@ class CSecurityContextSandboxedClient {
static SP<CSecurityContextSandboxedClient> create(int clientFD);
~CSecurityContextSandboxedClient();
- void onDestroy();
+ void onDestroy();
- CSecurityContextSandboxedClientDestroyWrapper destroyListener;
+ SCSecurityContextSandboxedClientDestroyWrapper destroyListener;
private:
CSecurityContextSandboxedClient(int clientFD_);
diff --git a/src/protocols/Tablet.cpp b/src/protocols/Tablet.cpp
index d7f741b9..b4ab6ea0 100644
--- a/src/protocols/Tablet.cpp
+++ b/src/protocols/Tablet.cpp
@@ -251,7 +251,7 @@ void CTabletSeat::sendTool(SP<CTabletTool> tool) {
resource->sendToolAdded(RESOURCE->resource.get());
RESOURCE->sendData();
- tools.push_back(RESOURCE);
+ tools.emplace_back(RESOURCE);
}
void CTabletSeat::sendPad(SP<CTabletPad> pad) {
@@ -267,7 +267,7 @@ void CTabletSeat::sendPad(SP<CTabletPad> pad) {
resource->sendPadAdded(RESOURCE->resource.get());
RESOURCE->sendData();
- pads.push_back(RESOURCE);
+ pads.emplace_back(RESOURCE);
}
void CTabletSeat::sendTablet(SP<CTablet> tablet) {
@@ -283,7 +283,7 @@ void CTabletSeat::sendTablet(SP<CTablet> tablet) {
resource->sendTabletAdded(RESOURCE->resource.get());
RESOURCE->sendData();
- tablets.push_back(RESOURCE);
+ tablets.emplace_back(RESOURCE);
}
void CTabletSeat::sendData() {
@@ -371,7 +371,7 @@ void CTabletV2Protocol::registerDevice(SP<CTablet> tablet) {
s->sendTablet(tablet);
}
- tablets.push_back(tablet);
+ tablets.emplace_back(tablet);
}
void CTabletV2Protocol::registerDevice(SP<CTabletTool> tool) {
@@ -379,7 +379,7 @@ void CTabletV2Protocol::registerDevice(SP<CTabletTool> tool) {
s->sendTool(tool);
}
- tools.push_back(tool);
+ tools.emplace_back(tool);
}
void CTabletV2Protocol::registerDevice(SP<CTabletPad> pad) {
@@ -387,7 +387,7 @@ void CTabletV2Protocol::registerDevice(SP<CTabletPad> pad) {
s->sendPad(pad);
}
- pads.push_back(pad);
+ pads.emplace_back(pad);
}
void CTabletV2Protocol::unregisterDevice(SP<CTablet> tablet) {
diff --git a/src/protocols/TextInputV1.cpp b/src/protocols/TextInputV1.cpp
index dad74b53..6395e158 100644
--- a/src/protocols/TextInputV1.cpp
+++ b/src/protocols/TextInputV1.cpp
@@ -50,10 +50,10 @@ CTextInputV1::CTextInputV1(SP<CZwpTextInputV1> resource_) : resource(resource_)
});
// nothing
- resource->setShowInputPanel([this](CZwpTextInputV1* pMgr) {});
- resource->setHideInputPanel([this](CZwpTextInputV1* pMgr) {});
- resource->setSetPreferredLanguage([this](CZwpTextInputV1* pMgr, const char* language) {});
- resource->setInvokeAction([this](CZwpTextInputV1* pMgr, uint32_t button, uint32_t index) {});
+ resource->setShowInputPanel([](CZwpTextInputV1* pMgr) {});
+ resource->setHideInputPanel([](CZwpTextInputV1* pMgr) {});
+ resource->setSetPreferredLanguage([](CZwpTextInputV1* pMgr, const char* language) {});
+ resource->setInvokeAction([](CZwpTextInputV1* pMgr, uint32_t button, uint32_t index) {});
}
bool CTextInputV1::good() {
@@ -101,7 +101,7 @@ CTextInputV1Protocol::CTextInputV1Protocol(const wl_interface* iface, const int&
void CTextInputV1Protocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
const auto RESOURCE = m_vManagers.emplace_back(makeShared<CZwpTextInputManagerV1>(client, ver, id));
- RESOURCE->setOnDestroy([this](CZwpTextInputManagerV1* pMgr) { PROTO::textInputV1->destroyResource(pMgr); });
+ RESOURCE->setOnDestroy([](CZwpTextInputManagerV1* pMgr) { PROTO::textInputV1->destroyResource(pMgr); });
RESOURCE->setCreateTextInput([this](CZwpTextInputManagerV1* pMgr, uint32_t id) {
const auto PTI = m_vClients.emplace_back(makeShared<CTextInputV1>(makeShared<CZwpTextInputV1>(pMgr->client(), pMgr->version(), id)));
LOGM(LOG, "New TI V1 at {:x}", (uintptr_t)PTI.get());
diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp
index d00e9dce..f5fbaa0c 100644
--- a/src/protocols/ToplevelExport.cpp
+++ b/src/protocols/ToplevelExport.cpp
@@ -109,7 +109,7 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re
return;
}
- const auto PSHMINFO = FormatUtils::getPixelFormatFromDRM(shmFormat);
+ const auto PSHMINFO = NFormatUtils::getPixelFormatFromDRM(shmFormat);
if (!PSHMINFO) {
LOGM(ERR, "No pixel format supported by renderer in capture toplevel");
resource->sendFailed();
@@ -123,9 +123,9 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re
box.transform(wlTransformToHyprutils(PMONITOR->transform), PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y).round();
- shmStride = FormatUtils::minStride(PSHMINFO, box.w);
+ shmStride = NFormatUtils::minStride(PSHMINFO, box.w);
- resource->sendBuffer(FormatUtils::drmToShm(shmFormat), box.width, box.height, shmStride);
+ resource->sendBuffer(NFormatUtils::drmToShm(shmFormat), box.width, box.height, shmStride);
if (dmabufFormat != DRM_FORMAT_INVALID) {
resource->sendLinuxDmabuf(dmabufFormat, box.width, box.height);
@@ -265,7 +265,7 @@ bool CToplevelExportFrame::copyShm(timespec* now) {
if (overlayCursor)
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition.value());
- const auto PFORMAT = FormatUtils::getPixelFormatFromDRM(shm.format);
+ const auto PFORMAT = NFormatUtils::getPixelFormatFromDRM(shm.format);
if (!PFORMAT) {
g_pHyprRenderer->endRender();
return false;
diff --git a/src/protocols/ToplevelExport.hpp b/src/protocols/ToplevelExport.hpp
index bcfa161c..1ca3e5aa 100644
--- a/src/protocols/ToplevelExport.hpp
+++ b/src/protocols/ToplevelExport.hpp
@@ -5,7 +5,6 @@
#include "WaylandProtocol.hpp"
#include "Screencopy.hpp"
-#include <list>
#include <vector>
class CMonitor;
diff --git a/src/protocols/WaylandProtocol.cpp b/src/protocols/WaylandProtocol.cpp
index 00b112b0..5c6a4a56 100644
--- a/src/protocols/WaylandProtocol.cpp
+++ b/src/protocols/WaylandProtocol.cpp
@@ -6,8 +6,8 @@ static void bindManagerInternal(wl_client* client, void* data, uint32_t ver, uin
}
static void displayDestroyInternal(struct wl_listener* listener, void* data) {
- IWaylandProtocolDestroyWrapper* wrap = wl_container_of(listener, wrap, listener);
- IWaylandProtocol* proto = wrap->parent;
+ SIWaylandProtocolDestroyWrapper* wrap = wl_container_of(listener, wrap, listener);
+ IWaylandProtocol* proto = wrap->parent;
proto->onDisplayDestroy();
}
@@ -17,8 +17,8 @@ void IWaylandProtocol::onDisplayDestroy() {
wl_global_destroy(m_pGlobal);
}
-IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, const std::string& name) : m_szName(name) {
- m_pGlobal = wl_global_create(g_pCompositor->m_sWLDisplay, iface, ver, this, &bindManagerInternal);
+IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, const std::string& name) :
+ m_szName(name), m_pGlobal(wl_global_create(g_pCompositor->m_sWLDisplay, iface, ver, this, &bindManagerInternal)) {
if (!m_pGlobal) {
LOGM(ERR, "could not create a global [{}]", m_szName);
diff --git a/src/protocols/WaylandProtocol.hpp b/src/protocols/WaylandProtocol.hpp
index 056322ac..e3507708 100644
--- a/src/protocols/WaylandProtocol.hpp
+++ b/src/protocols/WaylandProtocol.hpp
@@ -41,7 +41,7 @@
} while (0)
class IWaylandProtocol;
-struct IWaylandProtocolDestroyWrapper {
+struct SIWaylandProtocolDestroyWrapper {
wl_listener listener;
IWaylandProtocol* parent = nullptr;
};
@@ -51,13 +51,13 @@ class IWaylandProtocol {
IWaylandProtocol(const wl_interface* iface, const int& ver, const std::string& name);
virtual ~IWaylandProtocol();
- virtual void onDisplayDestroy();
- virtual void removeGlobal();
- virtual wl_global* getGlobal();
+ virtual void onDisplayDestroy();
+ virtual void removeGlobal();
+ virtual wl_global* getGlobal();
- virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) = 0;
+ virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) = 0;
- IWaylandProtocolDestroyWrapper m_liDisplayDestroy;
+ SIWaylandProtocolDestroyWrapper m_liDisplayDestroy;
private:
std::string m_szName;
diff --git a/src/protocols/XDGDialog.cpp b/src/protocols/XDGDialog.cpp
index 237cf3f3..3f58f326 100644
--- a/src/protocols/XDGDialog.cpp
+++ b/src/protocols/XDGDialog.cpp
@@ -44,7 +44,7 @@ CXDGWmDialogManagerResource::CXDGWmDialogManagerResource(SP<CXdgWmDialogV1> reso
resource->setDestroy([this](CXdgWmDialogV1* r) { PROTO::xdgDialog->destroyResource(this); });
resource->setOnDestroy([this](CXdgWmDialogV1* r) { PROTO::xdgDialog->destroyResource(this); });
- resource->setGetXdgDialog([this](CXdgWmDialogV1* r, uint32_t id, wl_resource* toplevel) {
+ resource->setGetXdgDialog([](CXdgWmDialogV1* r, uint32_t id, wl_resource* toplevel) {
auto tl = CXDGToplevelResource::fromResource(toplevel);
if (!tl) {
r->error(-1, "Toplevel inert");
diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp
index 688d0006..282aec47 100644
--- a/src/protocols/XDGShell.cpp
+++ b/src/protocols/XDGShell.cpp
@@ -551,8 +551,8 @@ bool CXDGPositionerResource::good() {
return resource->resource();
}
-CXDGPositionerRules::CXDGPositionerRules(SP<CXDGPositionerResource> positioner) {
- state = positioner->state;
+CXDGPositionerRules::CXDGPositionerRules(SP<CXDGPositionerResource> positioner) : state(positioner->state) {
+ ;
}
CBox CXDGPositionerRules::getPosition(CBox constraint, const Vector2D& parentCoord) {
diff --git a/src/protocols/XWaylandShell.cpp b/src/protocols/XWaylandShell.cpp
index d6c3b1a8..81194163 100644
--- a/src/protocols/XWaylandShell.cpp
+++ b/src/protocols/XWaylandShell.cpp
@@ -42,7 +42,7 @@ CXWaylandShellResource::CXWaylandShellResource(SP<CXwaylandShellV1> resource_) :
resource->setDestroy([this](CXwaylandShellV1* r) { PROTO::xwaylandShell->destroyResource(this); });
resource->setOnDestroy([this](CXwaylandShellV1* r) { PROTO::xwaylandShell->destroyResource(this); });
- resource->setGetXwaylandSurface([this](CXwaylandShellV1* r, uint32_t id, wl_resource* surface) {
+ resource->setGetXwaylandSurface([](CXwaylandShellV1* r, uint32_t id, wl_resource* surface) {
const auto RESOURCE = PROTO::xwaylandShell->m_vSurfaces.emplace_back(
makeShared<CXWaylandSurfaceResource>(makeShared<CXwaylandSurfaceV1>(r->client(), r->version(), id), CWLSurfaceResource::fromResource(surface)));
diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp
index 056a72c4..8ad5caae 100644
--- a/src/protocols/core/DataDevice.cpp
+++ b/src/protocols/core/DataDevice.cpp
@@ -119,7 +119,7 @@ CWLDataSourceResource::CWLDataSourceResource(SP<CWlDataSource> resource_, SP<CWL
PROTO::data->destroyResource(this);
});
- resource->setOffer([this](CWlDataSource* r, const char* mime) { mimeTypes.push_back(mime); });
+ resource->setOffer([this](CWlDataSource* r, const char* mime) { mimeTypes.emplace_back(mime); });
resource->setSetActions([this](CWlDataSource* r, uint32_t a) {
LOGM(LOG, "DataSource {:x} actions {}", (uintptr_t)this, a);
supportedActions = a;
@@ -311,7 +311,7 @@ CWLDataDeviceManagerResource::CWLDataDeviceManagerResource(SP<CWlDataDeviceManag
RESOURCE->self = RESOURCE;
- sources.push_back(RESOURCE);
+ sources.emplace_back(RESOURCE);
LOGM(LOG, "New data source bound at {:x}", (uintptr_t)RESOURCE.get());
});
diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp
index 7c31b67c..f7969a4d 100644
--- a/src/protocols/core/Seat.cpp
+++ b/src/protocols/core/Seat.cpp
@@ -442,7 +442,7 @@ CWLSeatResource::CWLSeatResource(SP<CWlSeat> resource_) : resource(resource_) {
return;
}
- keyboards.push_back(RESOURCE);
+ keyboards.emplace_back(RESOURCE);
});
resource->setGetPointer([this](CWlSeat* r, uint32_t id) {
@@ -454,7 +454,7 @@ CWLSeatResource::CWLSeatResource(SP<CWlSeat> resource_) : resource(resource_) {
return;
}
- pointers.push_back(RESOURCE);
+ pointers.emplace_back(RESOURCE);
});
resource->setGetTouch([this](CWlSeat* r, uint32_t id) {
@@ -466,7 +466,7 @@ CWLSeatResource::CWLSeatResource(SP<CWlSeat> resource_) : resource(resource_) {
return;
}
- touches.push_back(RESOURCE);
+ touches.emplace_back(RESOURCE);
});
if (resource->version() >= 2)
diff --git a/src/protocols/core/Shm.cpp b/src/protocols/core/Shm.cpp
index 708d41c3..fddd4e9a 100644
--- a/src/protocols/core/Shm.cpp
+++ b/src/protocols/core/Shm.cpp
@@ -19,9 +19,9 @@ CWLSHMBuffer::CWLSHMBuffer(SP<CWLSHMPoolResource> pool_, uint32_t id, int32_t of
stride = stride_;
fmt = fmt_;
offset = offset_;
- opaque = FormatUtils::isFormatOpaque(FormatUtils::shmToDRM(fmt_));
+ opaque = NFormatUtils::isFormatOpaque(NFormatUtils::shmToDRM(fmt_));
- texture = makeShared<CTexture>(FormatUtils::shmToDRM(fmt), (uint8_t*)pool->data + offset, stride, size_);
+ texture = makeShared<CTexture>(NFormatUtils::shmToDRM(fmt), (uint8_t*)pool->data + offset, stride, size_);
resource = CWLBufferResource::create(makeShared<CWlBuffer>(pool_->resource->client(), 1, id));
@@ -56,7 +56,7 @@ Aquamarine::SSHMAttrs CWLSHMBuffer::shm() {
Aquamarine::SSHMAttrs attrs;
attrs.success = true;
attrs.fd = pool->fd;
- attrs.format = FormatUtils::shmToDRM(fmt);
+ attrs.format = NFormatUtils::shmToDRM(fmt);
attrs.size = size;
attrs.stride = stride;
attrs.offset = offset;
@@ -76,11 +76,11 @@ bool CWLSHMBuffer::good() {
}
void CWLSHMBuffer::update(const CRegion& damage) {
- texture->update(FormatUtils::shmToDRM(fmt), (uint8_t*)pool->data + offset, stride, damage);
+ texture->update(NFormatUtils::shmToDRM(fmt), (uint8_t*)pool->data + offset, stride, damage);
}
-CSHMPool::CSHMPool(int fd_, size_t size_) : fd(fd_), size(size_) {
- data = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+CSHMPool::CSHMPool(int fd_, size_t size_) : fd(fd_), size(size_), data(mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) {
+ ;
}
CSHMPool::~CSHMPool() {
diff --git a/src/protocols/types/DMABuffer.cpp b/src/protocols/types/DMABuffer.cpp
index a8c7248e..2b4c1bac 100644
--- a/src/protocols/types/DMABuffer.cpp
+++ b/src/protocols/types/DMABuffer.cpp
@@ -27,7 +27,7 @@ CDMABuffer::CDMABuffer(uint32_t id, wl_client* client, Aquamarine::SDMABUFAttrs
}
texture = makeShared<CTexture>(attrs, eglImage); // texture takes ownership of the eglImage
- opaque = FormatUtils::isFormatOpaque(attrs.format);
+ opaque = NFormatUtils::isFormatOpaque(attrs.format);
success = texture->m_iTexID;
if (!success)
diff --git a/src/protocols/types/DataDevice.hpp b/src/protocols/types/DataDevice.hpp
index a62cc35e..80f75b8e 100644
--- a/src/protocols/types/DataDevice.hpp
+++ b/src/protocols/types/DataDevice.hpp
@@ -5,15 +5,15 @@
#include <cstdint>
#include "../../helpers/signal/Signal.hpp"
-enum eDataSourceType {
+enum eDataSourceType : uint8_t {
DATA_SOURCE_TYPE_WAYLAND = 0,
DATA_SOURCE_TYPE_X11,
};
class IDataSource {
public:
- IDataSource() {}
- virtual ~IDataSource() {}
+ IDataSource() = default;
+ virtual ~IDataSource() = default;
virtual std::vector<std::string> mimes() = 0;
virtual void send(const std::string& mime, uint32_t fd) = 0;
diff --git a/src/protocols/types/SurfaceRole.hpp b/src/protocols/types/SurfaceRole.hpp
index 64586f01..a6b55b69 100644
--- a/src/protocols/types/SurfaceRole.hpp
+++ b/src/protocols/types/SurfaceRole.hpp
@@ -1,6 +1,6 @@
#pragma once
-enum eSurfaceRole {
+enum eSurfaceRole : uint8_t {
SURFACE_ROLE_UNASSIGNED = 0,
SURFACE_ROLE_XDG_SHELL,
SURFACE_ROLE_LAYER_SHELL,