diff options
| author | davc0n <dconti.dev@gmail.com> | 2025-05-04 19:21:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-04 19:21:36 +0200 |
| commit | 2626f89ea6fe0df585df28052bf1fcca2c50fe8e (patch) | |
| tree | 6dd030f42e065e1a927ab907222e1efaf21b0bc1 /src/protocols/ShortcutsInhibit.cpp | |
| parent | adbae0f74d951e06c575bad3c81a944027dfe413 (diff) | |
protocols: refactor class member vars (n-t) (#10273)
Diffstat (limited to 'src/protocols/ShortcutsInhibit.cpp')
| -rw-r--r-- | src/protocols/ShortcutsInhibit.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
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<CZwpKeyboardShortcutsInhibitorV1> resource_, SP<CWLSurfaceResource> surf) : resource(resource_), pSurface(surf) { - if UNLIKELY (!resource->resource()) +CKeyboardShortcutsInhibitor::CKeyboardShortcutsInhibitor(SP<CZwpKeyboardShortcutsInhibitorV1> resource_, SP<CWLSurfaceResource> 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<CWLSurfaceResource> 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<CZwpKeyboardShortcutsInhibitManagerV1>(client, ver, id)).get(); + const auto RESOURCE = m_managers.emplace_back(makeUnique<CZwpKeyboardShortcutsInhibitManagerV1>(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<CWLSurfaceResource> 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<CKeyboardShortcutsInhibitor>(makeShared<CZwpKeyboardShortcutsInhibitorV1>(CLIENT, pMgr->version(), id), surf)).get(); + const auto RESOURCE = m_inhibitors.emplace_back(makeUnique<CKeyboardShortcutsInhibitor>(makeShared<CZwpKeyboardShortcutsInhibitorV1>(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; |
