mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-30 19:33:48 -07:00
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.
This commit is contained in:
@@ -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());
|
||||
});
|
||||
|
@@ -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),
|
||||
|
@@ -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();
|
||||
});
|
||||
|
||||
|
@@ -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);
|
||||
});
|
||||
|
@@ -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,
|
||||
|
@@ -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;
|
||||
|
@@ -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());
|
||||
});
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -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_);
|
||||
|
@@ -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) {
|
||||
|
@@ -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());
|
||||
|
@@ -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;
|
||||
|
@@ -5,7 +5,6 @@
|
||||
#include "WaylandProtocol.hpp"
|
||||
#include "Screencopy.hpp"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
class CMonitor;
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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");
|
||||
|
@@ -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) {
|
||||
|
@@ -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)));
|
||||
|
||||
|
@@ -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());
|
||||
});
|
||||
|
@@ -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)
|
||||
|
@@ -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() {
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
enum eSurfaceRole {
|
||||
enum eSurfaceRole : uint8_t {
|
||||
SURFACE_ROLE_UNASSIGNED = 0,
|
||||
SURFACE_ROLE_XDG_SHELL,
|
||||
SURFACE_ROLE_LAYER_SHELL,
|
||||
|
Reference in New Issue
Block a user