protocols: refactor class member vars (a-m) (#10265)
This commit is contained in:
parent
46ac115bd1
commit
adbae0f74d
58 changed files with 1566 additions and 1561 deletions
|
|
@ -24,14 +24,14 @@ CContentTypeManager::CContentTypeManager(SP<CWpContentTypeManagerV1> resource) :
|
|||
return;
|
||||
}
|
||||
|
||||
const auto RESOURCE = PROTO::contentType->m_vContentTypes.emplace_back(makeShared<CContentType>(makeShared<CWpContentTypeV1>(r->client(), r->version(), id)));
|
||||
const auto RESOURCE = PROTO::contentType->m_contentTypes.emplace_back(makeShared<CContentType>(makeShared<CWpContentTypeV1>(r->client(), r->version(), id)));
|
||||
if UNLIKELY (!RESOURCE->good()) {
|
||||
r->noMemory();
|
||||
PROTO::contentType->m_vContentTypes.pop_back();
|
||||
PROTO::contentType->m_contentTypes.pop_back();
|
||||
return;
|
||||
}
|
||||
|
||||
RESOURCE->self = RESOURCE;
|
||||
RESOURCE->m_self = RESOURCE;
|
||||
|
||||
SURF->m_contentType = RESOURCE;
|
||||
});
|
||||
|
|
@ -42,19 +42,19 @@ bool CContentTypeManager::good() {
|
|||
}
|
||||
|
||||
CContentType::CContentType(WP<CWLSurfaceResource> surface) {
|
||||
destroy = surface->m_events.destroy.registerListener([this](std::any d) { PROTO::contentType->destroyResource(this); });
|
||||
m_destroy = surface->m_events.destroy.registerListener([this](std::any d) { PROTO::contentType->destroyResource(this); });
|
||||
}
|
||||
|
||||
CContentType::CContentType(SP<CWpContentTypeV1> resource) : m_resource(resource) {
|
||||
if UNLIKELY (!good())
|
||||
return;
|
||||
|
||||
m_pClient = resource->client();
|
||||
m_client = resource->client();
|
||||
|
||||
resource->setDestroy([this](CWpContentTypeV1* r) { PROTO::contentType->destroyResource(this); });
|
||||
resource->setOnDestroy([this](CWpContentTypeV1* r) { PROTO::contentType->destroyResource(this); });
|
||||
|
||||
resource->setSetContentType([this](CWpContentTypeV1* r, wpContentTypeV1Type type) { value = NContentType::fromWP(type); });
|
||||
resource->setSetContentType([this](CWpContentTypeV1* r, wpContentTypeV1Type type) { m_value = NContentType::fromWP(type); });
|
||||
}
|
||||
|
||||
bool CContentType::good() {
|
||||
|
|
@ -62,7 +62,7 @@ bool CContentType::good() {
|
|||
}
|
||||
|
||||
wl_client* CContentType::client() {
|
||||
return m_pClient;
|
||||
return m_client;
|
||||
}
|
||||
|
||||
CContentTypeProtocol::CContentTypeProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
|
|
@ -70,11 +70,11 @@ CContentTypeProtocol::CContentTypeProtocol(const wl_interface* iface, const int&
|
|||
}
|
||||
|
||||
void CContentTypeProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||
const auto RESOURCE = m_vManagers.emplace_back(makeShared<CContentTypeManager>(makeShared<CWpContentTypeManagerV1>(client, ver, id)));
|
||||
const auto RESOURCE = m_managers.emplace_back(makeShared<CContentTypeManager>(makeShared<CWpContentTypeManagerV1>(client, ver, id)));
|
||||
|
||||
if UNLIKELY (!RESOURCE->good()) {
|
||||
wl_client_post_no_memory(client);
|
||||
m_vManagers.pop_back();
|
||||
m_managers.pop_back();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -83,13 +83,13 @@ SP<CContentType> CContentTypeProtocol::getContentType(WP<CWLSurfaceResource> sur
|
|||
if (surface->m_contentType.valid())
|
||||
return surface->m_contentType.lock();
|
||||
|
||||
return m_vContentTypes.emplace_back(makeShared<CContentType>(surface));
|
||||
return m_contentTypes.emplace_back(makeShared<CContentType>(surface));
|
||||
}
|
||||
|
||||
void CContentTypeProtocol::destroyResource(CContentTypeManager* resource) {
|
||||
std::erase_if(m_vManagers, [&](const auto& other) { return other.get() == resource; });
|
||||
std::erase_if(m_managers, [&](const auto& other) { return other.get() == resource; });
|
||||
}
|
||||
|
||||
void CContentTypeProtocol::destroyResource(CContentType* resource) {
|
||||
std::erase_if(m_vContentTypes, [&](const auto& other) { return other.get() == resource; });
|
||||
std::erase_if(m_contentTypes, [&](const auto& other) { return other.get() == resource; });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue