From 2626f89ea6fe0df585df28052bf1fcca2c50fe8e Mon Sep 17 00:00:00 2001 From: davc0n Date: Sun, 4 May 2025 19:21:36 +0200 Subject: protocols: refactor class member vars (n-t) (#10273) --- src/protocols/ShortcutsInhibit.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src/protocols/ShortcutsInhibit.cpp') diff --git a/src/protocols/ShortcutsInhibit.cpp b/src/protocols/ShortcutsInhibit.cpp index b9219f72..b33db998 100644 --- a/src/protocols/ShortcutsInhibit.cpp +++ b/src/protocols/ShortcutsInhibit.cpp @@ -3,24 +3,24 @@ #include "../Compositor.hpp" #include "core/Compositor.hpp" -CKeyboardShortcutsInhibitor::CKeyboardShortcutsInhibitor(SP resource_, SP surf) : resource(resource_), pSurface(surf) { - if UNLIKELY (!resource->resource()) +CKeyboardShortcutsInhibitor::CKeyboardShortcutsInhibitor(SP resource_, SP surf) : m_resource(resource_), m_surface(surf) { + if UNLIKELY (!m_resource->resource()) return; - resource->setDestroy([this](CZwpKeyboardShortcutsInhibitorV1* pMgr) { PROTO::shortcutsInhibit->destroyInhibitor(this); }); - resource->setOnDestroy([this](CZwpKeyboardShortcutsInhibitorV1* pMgr) { PROTO::shortcutsInhibit->destroyInhibitor(this); }); + m_resource->setDestroy([this](CZwpKeyboardShortcutsInhibitorV1* pMgr) { PROTO::shortcutsInhibit->destroyInhibitor(this); }); + m_resource->setOnDestroy([this](CZwpKeyboardShortcutsInhibitorV1* pMgr) { PROTO::shortcutsInhibit->destroyInhibitor(this); }); // I don't really care about following the spec here that much, // let's make the app believe it's always active - resource->sendActive(); + m_resource->sendActive(); } SP CKeyboardShortcutsInhibitor::surface() { - return pSurface.lock(); + return m_surface.lock(); } bool CKeyboardShortcutsInhibitor::good() { - return resource->resource(); + return m_resource->resource(); } CKeyboardShortcutsInhibitProtocol::CKeyboardShortcutsInhibitProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { @@ -28,7 +28,7 @@ CKeyboardShortcutsInhibitProtocol::CKeyboardShortcutsInhibitProtocol(const wl_in } void CKeyboardShortcutsInhibitProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) { - const auto RESOURCE = m_vManagers.emplace_back(makeUnique(client, ver, id)).get(); + const auto RESOURCE = m_managers.emplace_back(makeUnique(client, ver, id)).get(); RESOURCE->setOnDestroy([this](CZwpKeyboardShortcutsInhibitManagerV1* p) { this->onManagerResourceDestroy(p->resource()); }); RESOURCE->setDestroy([this](CZwpKeyboardShortcutsInhibitManagerV1* pMgr) { this->onManagerResourceDestroy(pMgr->resource()); }); @@ -37,18 +37,18 @@ void CKeyboardShortcutsInhibitProtocol::bindManager(wl_client* client, void* dat } void CKeyboardShortcutsInhibitProtocol::onManagerResourceDestroy(wl_resource* res) { - std::erase_if(m_vManagers, [&](const auto& other) { return other->resource() == res; }); + std::erase_if(m_managers, [&](const auto& other) { return other->resource() == res; }); } void CKeyboardShortcutsInhibitProtocol::destroyInhibitor(CKeyboardShortcutsInhibitor* inhibitor) { - std::erase_if(m_vInhibitors, [&](const auto& other) { return other.get() == inhibitor; }); + std::erase_if(m_inhibitors, [&](const auto& other) { return other.get() == inhibitor; }); } void CKeyboardShortcutsInhibitProtocol::onInhibit(CZwpKeyboardShortcutsInhibitManagerV1* pMgr, uint32_t id, wl_resource* surface, wl_resource* seat) { SP surf = CWLSurfaceResource::fromResource(surface); const auto CLIENT = pMgr->client(); - for (auto const& in : m_vInhibitors) { + for (auto const& in : m_inhibitors) { if LIKELY (in->surface() != surf) continue; @@ -56,12 +56,11 @@ void CKeyboardShortcutsInhibitProtocol::onInhibit(CZwpKeyboardShortcutsInhibitMa return; } - const auto RESOURCE = - m_vInhibitors.emplace_back(makeUnique(makeShared(CLIENT, pMgr->version(), id), surf)).get(); + const auto RESOURCE = m_inhibitors.emplace_back(makeUnique(makeShared(CLIENT, pMgr->version(), id), surf)).get(); if UNLIKELY (!RESOURCE->good()) { pMgr->noMemory(); - m_vInhibitors.pop_back(); + m_inhibitors.pop_back(); LOGM(ERR, "Failed to create an inhibitor resource"); return; } @@ -74,7 +73,7 @@ bool CKeyboardShortcutsInhibitProtocol::isInhibited() { if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); PWINDOW && PWINDOW->m_windowData.noShortcutsInhibit.valueOrDefault()) return false; - for (auto const& in : m_vInhibitors) { + for (auto const& in : m_inhibitors) { if (in->surface() != g_pCompositor->m_lastFocus) continue; -- cgit v1.2.3