diff options
author | Tom Englund <[email protected]> | 2024-08-26 20:24:30 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-26 20:24:30 +0200 |
commit | 72c7818ae66a18d126e2b4245d649fe3a93d3b8e (patch) | |
tree | 194361ee0d4f92eea809b7904d39f02793c55e13 /src/protocols | |
parent | 1ea47950f4262ec1215087948c7275f8e0115af2 (diff) | |
download | Hyprland-72c7818ae66a18d126e2b4245d649fe3a93d3b8e.tar.gz Hyprland-72c7818ae66a18d126e2b4245d649fe3a93d3b8e.zip |
misc: constify the remaining for loops (#7534)
now we roll loops at blazing constified speed.
Diffstat (limited to 'src/protocols')
32 files changed, 138 insertions, 138 deletions
diff --git a/src/protocols/DRMLease.cpp b/src/protocols/DRMLease.cpp index f906740c..37f2e2eb 100644 --- a/src/protocols/DRMLease.cpp +++ b/src/protocols/DRMLease.cpp @@ -14,7 +14,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe parent = request->parent; requested = request->requested; - for (auto& m : requested) { + for (auto const& m : requested) { if (!m->monitor || m->monitor->isBeingLeased) { LOGM(ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->monitor ? m->monitor->szName : "null")); resource->sendFinished(); @@ -26,14 +26,14 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe LOGM(LOG, "Leasing outputs: {}", [this]() { std::string roll; - for (auto& o : requested) { + for (auto const& o : requested) { roll += std::format("{} ", o->monitor->szName); } return roll; }()); std::vector<SP<Aquamarine::IOutput>> outputs; - for (auto& m : requested) { + for (auto const& m : requested) { outputs.emplace_back(m->monitor->output); } @@ -184,7 +184,7 @@ CDRMLeaseDeviceResource::CDRMLeaseDeviceResource(SP<CWpDrmLeaseDeviceV1> resourc resource->sendDrmFd(fd); close(fd); - for (auto& m : PROTO::lease->primaryDevice->offeredOutputs) { + for (auto const& m : PROTO::lease->primaryDevice->offeredOutputs) { sendConnector(m.lock()); } @@ -234,7 +234,7 @@ CDRMLeaseDevice::CDRMLeaseDevice(SP<Aquamarine::CDRMBackend> drmBackend) : backe } CDRMLeaseProtocol::CDRMLeaseProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { - for (auto& b : g_pCompositor->m_pAqBackend->getImplementations()) { + for (auto const& b : g_pCompositor->m_pAqBackend->getImplementations()) { if (b->type() != Aquamarine::AQ_BACKEND_DRM) continue; @@ -292,7 +292,7 @@ void CDRMLeaseProtocol::offer(SP<CMonitor> monitor) { primaryDevice->offeredOutputs.emplace_back(monitor); - for (auto& m : m_vManagers) { + for (auto const& m : m_vManagers) { m->sendConnector(monitor); m->resource->sendDone(); } diff --git a/src/protocols/DataDeviceWlr.cpp b/src/protocols/DataDeviceWlr.cpp index dce64508..d2d06644 100644 --- a/src/protocols/DataDeviceWlr.cpp +++ b/src/protocols/DataDeviceWlr.cpp @@ -37,7 +37,7 @@ void CWLRDataOffer::sendData() { if (!source) return; - for (auto& m : source->mimes()) { + for (auto const& m : source->mimes()) { resource->sendOffer(m.c_str()); } } @@ -191,7 +191,7 @@ CWLRDataControlManagerResource::CWLRDataControlManagerResource(SP<CZwlrDataContr RESOURCE->self = RESOURCE; device = RESOURCE; - for (auto& s : sources) { + for (auto const& s : sources) { if (!s) continue; s->device = RESOURCE; diff --git a/src/protocols/FocusGrab.cpp b/src/protocols/FocusGrab.cpp index 2d6b2ee2..aff232e4 100644 --- a/src/protocols/FocusGrab.cpp +++ b/src/protocols/FocusGrab.cpp @@ -103,7 +103,7 @@ void CFocusGrab::refocusKeyboard() { return; SP<CWLSurfaceResource> surface = nullptr; - for (auto& [surf, state] : m_mSurfaces) { + for (auto const& [surf, state] : m_mSurfaces) { if (state->state == CFocusGrabSurfaceState::Comitted) { surface = surf.lock(); break; diff --git a/src/protocols/ForeignToplevel.cpp b/src/protocols/ForeignToplevel.cpp index 59888ce2..1f8cbcbe 100644 --- a/src/protocols/ForeignToplevel.cpp +++ b/src/protocols/ForeignToplevel.cpp @@ -30,7 +30,7 @@ CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resourc LOGM(LOG, "CForeignToplevelList: finished"); }); - for (auto& w : g_pCompositor->m_vWindows) { + for (auto const& w : g_pCompositor->m_vWindows) { if (!w->m_bIsMapped || w->m_bFadingOut) continue; @@ -112,19 +112,19 @@ bool CForeignToplevelList::good() { CForeignToplevelProtocol::CForeignToplevelProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) { - for (auto& m : m_vManagers) { + for (auto const& m : m_vManagers) { m->onMap(std::any_cast<PHLWINDOW>(data)); } }); static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) { - for (auto& m : m_vManagers) { + for (auto const& m : m_vManagers) { m->onUnmap(std::any_cast<PHLWINDOW>(data)); } }); static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) { - for (auto& m : m_vManagers) { + for (auto const& m : m_vManagers) { m->onTitle(std::any_cast<PHLWINDOW>(data)); } }); diff --git a/src/protocols/ForeignToplevelWlr.cpp b/src/protocols/ForeignToplevelWlr.cpp index bd597a91..291969db 100644 --- a/src/protocols/ForeignToplevelWlr.cpp +++ b/src/protocols/ForeignToplevelWlr.cpp @@ -179,7 +179,7 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa PROTO::foreignToplevelWlr->onManagerResourceDestroy(this); }); - for (auto& w : g_pCompositor->m_vWindows) { + for (auto const& w : g_pCompositor->m_vWindows) { if (!w->m_bIsMapped || w->m_bFadingOut) continue; @@ -313,42 +313,42 @@ bool CForeignToplevelWlrManager::good() { CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(data); - for (auto& m : m_vManagers) { + for (auto const& m : m_vManagers) { m->onMap(PWINDOW); } }); static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(data); - for (auto& m : m_vManagers) { + for (auto const& m : m_vManagers) { m->onUnmap(PWINDOW); } }); static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(data); - for (auto& m : m_vManagers) { + for (auto const& m : m_vManagers) { m->onTitle(PWINDOW); } }); static auto P3 = g_pHookSystem->hookDynamic("activeWindow", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(data); - for (auto& m : m_vManagers) { + for (auto const& m : m_vManagers) { m->onNewFocus(PWINDOW); } }); static auto P4 = g_pHookSystem->hookDynamic("moveWindow", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(std::any_cast<std::vector<std::any>>(data).at(0)); - for (auto& m : m_vManagers) { + for (auto const& m : m_vManagers) { m->onMoveMonitor(PWINDOW); } }); static auto P5 = g_pHookSystem->hookDynamic("fullscreen", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(data); - for (auto& m : m_vManagers) { + for (auto const& m : m_vManagers) { m->onFullscreen(PWINDOW); } }); @@ -374,7 +374,7 @@ void CForeignToplevelWlrProtocol::destroyHandle(CForeignToplevelHandleWlr* handl } PHLWINDOW CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res) { - for (auto& h : m_vHandles) { + for (auto const& h : m_vHandles) { if (h->res() != res) continue; diff --git a/src/protocols/FractionalScale.cpp b/src/protocols/FractionalScale.cpp index d39fa67c..d8010eac 100644 --- a/src/protocols/FractionalScale.cpp +++ b/src/protocols/FractionalScale.cpp @@ -24,7 +24,7 @@ void CFractionalScaleProtocol::onManagerResourceDestroy(wl_resource* res) { } void CFractionalScaleProtocol::onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, SP<CWLSurfaceResource> surface) { - for (auto& [k, v] : m_mAddons) { + for (auto const& [k, v] : m_mAddons) { if (k == surface) { LOGM(ERR, "Surface {:x} already has a fractionalScale addon", (uintptr_t)surface.get()); pMgr->error(WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_FRACTIONAL_SCALE_EXISTS, "Fractional scale already exists"); diff --git a/src/protocols/GammaControl.cpp b/src/protocols/GammaControl.cpp index c902d00e..cb75a202 100644 --- a/src/protocols/GammaControl.cpp +++ b/src/protocols/GammaControl.cpp @@ -25,7 +25,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out return; } - for (auto& g : PROTO::gamma->m_vGammaControllers) { + for (auto const& g : PROTO::gamma->m_vGammaControllers) { if (g->pMonitor == pMonitor) { resource->sendFailed(); return; @@ -180,7 +180,7 @@ void CGammaControlProtocol::onGetGammaControl(CZwlrGammaControlManagerV1* pMgr, } void CGammaControlProtocol::applyGammaToState(CMonitor* pMonitor) { - for (auto& g : m_vGammaControllers) { + for (auto const& g : m_vGammaControllers) { if (g->getMonitor() != pMonitor) continue; diff --git a/src/protocols/GlobalShortcuts.cpp b/src/protocols/GlobalShortcuts.cpp index 92bfbae4..b02126ef 100644 --- a/src/protocols/GlobalShortcuts.cpp +++ b/src/protocols/GlobalShortcuts.cpp @@ -54,8 +54,8 @@ void CGlobalShortcutsProtocol::destroyResource(CShortcutClient* client) { } bool CGlobalShortcutsProtocol::isTaken(std::string appid, std::string trigger) { - for (auto& c : m_vClients) { - for (auto& sh : c->shortcuts) { + for (auto const& c : m_vClients) { + for (auto const& sh : c->shortcuts) { if (sh->appid == appid && sh->id == trigger) { return true; } @@ -66,8 +66,8 @@ bool CGlobalShortcutsProtocol::isTaken(std::string appid, std::string trigger) { } void CGlobalShortcutsProtocol::sendGlobalShortcutEvent(std::string appid, std::string trigger, bool pressed) { - for (auto& c : m_vClients) { - for (auto& sh : c->shortcuts) { + for (auto const& c : m_vClients) { + for (auto const& sh : c->shortcuts) { if (sh->appid == appid && sh->id == trigger) { timespec now; clock_gettime(CLOCK_MONOTONIC, &now); @@ -84,8 +84,8 @@ void CGlobalShortcutsProtocol::sendGlobalShortcutEvent(std::string appid, std::s std::vector<SShortcut> CGlobalShortcutsProtocol::getAllShortcuts() { std::vector<SShortcut> copy; - for (auto& c : m_vClients) { - for (auto& sh : c->shortcuts) { + for (auto const& c : m_vClients) { + for (auto const& sh : c->shortcuts) { copy.push_back(*sh); } } diff --git a/src/protocols/IdleNotify.cpp b/src/protocols/IdleNotify.cpp index 8d915ac6..3517a62d 100644 --- a/src/protocols/IdleNotify.cpp +++ b/src/protocols/IdleNotify.cpp @@ -86,14 +86,14 @@ void CIdleNotifyProtocol::onGetNotification(CExtIdleNotifierV1* pMgr, uint32_t i } void CIdleNotifyProtocol::onActivity() { - for (auto& n : m_vNotifications) { + for (auto const& n : m_vNotifications) { n->onActivity(); } } void CIdleNotifyProtocol::setInhibit(bool inhibited) { isInhibited = inhibited; - for (auto& n : m_vNotifications) { + for (auto const& n : m_vNotifications) { n->onActivity(); } }
\ No newline at end of file diff --git a/src/protocols/InputMethodV2.cpp b/src/protocols/InputMethodV2.cpp index a0820e0b..5fd1e893 100644 --- a/src/protocols/InputMethodV2.cpp +++ b/src/protocols/InputMethodV2.cpp @@ -268,7 +268,7 @@ wl_client* CInputMethodV2::grabClient() { if (grabs.empty()) return nullptr; - for (auto& gw : grabs) { + for (auto const& gw : grabs) { auto g = gw.lock(); if (!g) @@ -282,7 +282,7 @@ wl_client* CInputMethodV2::grabClient() { void CInputMethodV2::sendInputRectangle(const CBox& box) { inputRectangle = box; - for (auto& wp : popups) { + for (auto const& wp : popups) { auto p = wp.lock(); if (!p) @@ -293,7 +293,7 @@ void CInputMethodV2::sendInputRectangle(const CBox& box) { } void CInputMethodV2::sendKey(uint32_t time, uint32_t key, wl_keyboard_key_state state) { - for (auto& gw : grabs) { + for (auto const& gw : grabs) { auto g = gw.lock(); if (!g) @@ -304,7 +304,7 @@ void CInputMethodV2::sendKey(uint32_t time, uint32_t key, wl_keyboard_key_state } void CInputMethodV2::sendMods(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group) { - for (auto& gw : grabs) { + for (auto const& gw : grabs) { auto g = gw.lock(); if (!g) @@ -315,7 +315,7 @@ void CInputMethodV2::sendMods(uint32_t depressed, uint32_t latched, uint32_t loc } void CInputMethodV2::setKeyboard(SP<IKeyboard> keyboard) { - for (auto& gw : grabs) { + for (auto const& gw : grabs) { auto g = gw.lock(); if (!g) diff --git a/src/protocols/LinuxDMABUF.cpp b/src/protocols/LinuxDMABUF.cpp index 32625792..d9dd1d01 100644 --- a/src/protocols/LinuxDMABUF.cpp +++ b/src/protocols/LinuxDMABUF.cpp @@ -31,8 +31,8 @@ CDMABUFFormatTable::CDMABUFFormatTable(SDMABUFTranche _rendererTranche, std::vec size_t i = 0; rendererTranche.indicies.clear(); - for (auto& fmt : rendererTranche.formats) { - for (auto& mod : fmt.modifiers) { + for (auto const& fmt : rendererTranche.formats) { + for (auto const& mod : fmt.modifiers) { auto format = std::make_pair<>(fmt.drmFormat, mod); auto [_, inserted] = formats.insert(format); if (inserted) { @@ -53,8 +53,8 @@ CDMABUFFormatTable::CDMABUFFormatTable(SDMABUFTranche _rendererTranche, std::vec for (auto& [monitor, tranche] : monitorTranches) { tranche.indicies.clear(); - for (auto& fmt : tranche.formats) { - for (auto& mod : fmt.modifiers) { + for (auto const& fmt : tranche.formats) { + for (auto const& mod : fmt.modifiers) { // apparently these can implode on planes, so dont use them if (mod == DRM_FORMAT_MOD_INVALID || mod == DRM_FORMAT_MOD_LINEAR) continue; @@ -270,7 +270,7 @@ bool CLinuxDMABBUFParamsResource::verify() { } bool empty = false; - for (auto& plane : attrs->fds) { + for (auto const& plane : attrs->fds) { if (empty && plane != -1) { resource->error(ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT, "Gap in planes"); return false; @@ -402,8 +402,8 @@ bool CLinuxDMABUFResource::good() { } void CLinuxDMABUFResource::sendMods() { - for (auto& fmt : PROTO::linuxDma->formatTable->rendererTranche.formats) { - for (auto& mod : fmt.modifiers) { + for (auto const& fmt : PROTO::linuxDma->formatTable->rendererTranche.formats) { + for (auto const& mod : fmt.modifiers) { if (resource->version() < 3) { if (mod == DRM_FORMAT_MOD_INVALID || mod == DRM_FORMAT_MOD_LINEAR) resource->sendFormat(fmt.drmFormat); @@ -442,7 +442,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const // this assumes there's only 1 device used for both scanout and rendering // also that each monitor never changes its primary plane - for (auto& mon : g_pCompositor->m_vMonitors) { + for (auto const& mon : g_pCompositor->m_vMonitors) { auto tranche = SDMABUFTranche{ .device = mainDevice, .flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT, @@ -505,7 +505,7 @@ void CLinuxDMABufV1Protocol::resetFormatTable() { // this might be a big copy auto newFormatTable = std::make_unique<CDMABUFFormatTable>(formatTable->rendererTranche, formatTable->monitorTranches); - for (auto& feedback : m_vFeedbacks) { + for (auto const& feedback : m_vFeedbacks) { feedback->resource->sendFormatTable(newFormatTable->tableFD, newFormatTable->tableSize); if (feedback->lastFeedbackWasScanout) { SP<CMonitor> mon; @@ -562,7 +562,7 @@ void CLinuxDMABufV1Protocol::destroyResource(CLinuxDMABuffer* resource) { void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface, SP<CMonitor> pMonitor) { SP<CLinuxDMABUFFeedbackResource> feedbackResource; - for (auto& f : m_vFeedbacks) { + for (auto const& f : m_vFeedbacks) { if (f->surface != surface) continue; diff --git a/src/protocols/MesaDRM.cpp b/src/protocols/MesaDRM.cpp index 9fcd5f9b..b4efd2c8 100644 --- a/src/protocols/MesaDRM.cpp +++ b/src/protocols/MesaDRM.cpp @@ -60,11 +60,11 @@ CMesaDRMResource::CMesaDRMResource(SP<CWlDrm> resource_) : resource(resource_) { uint64_t mod = DRM_FORMAT_MOD_INVALID; auto fmts = g_pHyprOpenGL->getDRMFormats(); - for (auto& f : fmts) { + for (auto const& f : fmts) { if (f.drmFormat != fmt) continue; - for (auto& m : f.modifiers) { + for (auto const& m : f.modifiers) { if (m == DRM_FORMAT_MOD_LINEAR) continue; @@ -100,7 +100,7 @@ CMesaDRMResource::CMesaDRMResource(SP<CWlDrm> resource_) : resource(resource_) { resource->sendCapabilities(WL_DRM_CAPABILITY_PRIME); auto fmts = g_pHyprOpenGL->getDRMFormats(); - for (auto& fmt : fmts) { + for (auto const& fmt : fmts) { resource->sendFormat(fmt.drmFormat); } } diff --git a/src/protocols/OutputManagement.cpp b/src/protocols/OutputManagement.cpp index cfe388fa..09552b19 100644 --- a/src/protocols/OutputManagement.cpp +++ b/src/protocols/OutputManagement.cpp @@ -28,7 +28,7 @@ COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : resource(re }); // send all heads at start - for (auto& m : g_pCompositor->m_vRealMonitors) { + for (auto const& m : g_pCompositor->m_vRealMonitors) { if (m.get() == g_pCompositor->m_pUnsafeOutput) continue; @@ -67,7 +67,7 @@ void COutputManager::ensureMonitorSent(CMonitor* pMonitor) { if (pMonitor == g_pCompositor->m_pUnsafeOutput) return; - for (auto& hw : heads) { + for (auto const& hw : heads) { auto h = hw.lock(); if (!h) @@ -96,7 +96,7 @@ COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, CMonitor* pMonitor_) : listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any d) { resource->sendFinished(); - for (auto& mw : modes) { + for (auto const& mw : modes) { auto m = mw.lock(); if (!m) @@ -106,7 +106,7 @@ COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, CMonitor* pMonitor_) : } pMonitor = nullptr; - for (auto& m : PROTO::outputManagement->m_vManagers) { + for (auto const& m : PROTO::outputManagement->m_vManagers) { m->sendDone(); } }); @@ -147,7 +147,7 @@ void COutputHead::sendAllData() { if (modes.empty()) { if (!pMonitor->output->modes.empty()) { - for (auto& m : pMonitor->output->modes) { + for (auto const& m : pMonitor->output->modes) { makeAndSendNewMode(m); } } else if (pMonitor->output->state->state().customMode) { @@ -158,7 +158,7 @@ void COutputHead::sendAllData() { // send current mode if (pMonitor->m_bEnabled) { - for (auto& mw : modes) { + for (auto const& mw : modes) { auto m = mw.lock(); if (!m) @@ -189,7 +189,7 @@ void COutputHead::updateMode() { resource->sendAdaptiveSync(pMonitor->vrrActive ? ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED : ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_DISABLED); if (pMonitor->m_bEnabled) { - for (auto& mw : modes) { + for (auto const& mw : modes) { auto m = mw.lock(); if (!m) @@ -346,7 +346,7 @@ bool COutputConfiguration::applyTestConfiguration(bool test) { LOGM(LOG, "Applying configuration"); - for (auto& headw : heads) { + for (auto const& headw : heads) { auto head = headw.lock(); if (!head) @@ -577,15 +577,15 @@ void COutputManagementProtocol::destroyResource(COutputConfigurationHead* resour } void COutputManagementProtocol::updateAllOutputs() { - for (auto& m : g_pCompositor->m_vRealMonitors) { - for (auto& mgr : m_vManagers) { + for (auto const& m : g_pCompositor->m_vRealMonitors) { + for (auto const& mgr : m_vManagers) { mgr->ensureMonitorSent(m.get()); } } } SP<COutputHead> COutputManagementProtocol::headFromResource(wl_resource* r) { - for (auto& h : m_vHeads) { + for (auto const& h : m_vHeads) { if (h->resource->resource() == r) return h; } @@ -594,7 +594,7 @@ SP<COutputHead> COutputManagementProtocol::headFromResource(wl_resource* r) { } SP<COutputMode> COutputManagementProtocol::modeFromResource(wl_resource* r) { - for (auto& h : m_vModes) { + for (auto const& h : m_vModes) { if (h->resource->resource() == r) return h; } diff --git a/src/protocols/PointerGestures.cpp b/src/protocols/PointerGestures.cpp index c83e3887..4eb74102 100644 --- a/src/protocols/PointerGestures.cpp +++ b/src/protocols/PointerGestures.cpp @@ -111,7 +111,7 @@ void CPointerGesturesProtocol::swipeBegin(uint32_t timeMs, uint32_t fingers) { const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock()); - for (auto& sw : m_vSwipes) { + for (auto const& sw : m_vSwipes) { if (sw->resource->client() != FOCUSEDCLIENT) continue; @@ -125,7 +125,7 @@ void CPointerGesturesProtocol::swipeUpdate(uint32_t timeMs, const Vector2D& delt const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client(); - for (auto& sw : m_vSwipes) { + for (auto const& sw : m_vSwipes) { if (sw->resource->client() != FOCUSEDCLIENT) continue; @@ -141,7 +141,7 @@ void CPointerGesturesProtocol::swipeEnd(uint32_t timeMs, bool cancelled) { const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock()); - for (auto& sw : m_vSwipes) { + for (auto const& sw : m_vSwipes) { if (sw->resource->client() != FOCUSEDCLIENT) continue; @@ -157,7 +157,7 @@ void CPointerGesturesProtocol::pinchBegin(uint32_t timeMs, uint32_t fingers) { const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock()); - for (auto& sw : m_vPinches) { + for (auto const& sw : m_vPinches) { if (sw->resource->client() != FOCUSEDCLIENT) continue; @@ -171,7 +171,7 @@ void CPointerGesturesProtocol::pinchUpdate(uint32_t timeMs, const Vector2D& delt const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client(); - for (auto& sw : m_vPinches) { + for (auto const& sw : m_vPinches) { if (sw->resource->client() != FOCUSEDCLIENT) continue; @@ -187,7 +187,7 @@ void CPointerGesturesProtocol::pinchEnd(uint32_t timeMs, bool cancelled) { const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock()); - for (auto& sw : m_vPinches) { + for (auto const& sw : m_vPinches) { if (sw->resource->client() != FOCUSEDCLIENT) continue; @@ -203,7 +203,7 @@ void CPointerGesturesProtocol::holdBegin(uint32_t timeMs, uint32_t fingers) { const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock()); - for (auto& sw : m_vHolds) { + for (auto const& sw : m_vHolds) { if (sw->resource->client() != FOCUSEDCLIENT) continue; @@ -219,7 +219,7 @@ void CPointerGesturesProtocol::holdEnd(uint32_t timeMs, bool cancelled) { const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock()); - for (auto& sw : m_vHolds) { + for (auto const& sw : m_vHolds) { if (sw->resource->client() != FOCUSEDCLIENT) continue; diff --git a/src/protocols/PresentationTime.cpp b/src/protocols/PresentationTime.cpp index 638435c7..b1108042 100644 --- a/src/protocols/PresentationTime.cpp +++ b/src/protocols/PresentationTime.cpp @@ -114,11 +114,11 @@ void CPresentationProtocol::onPresented(CMonitor* pMonitor, timespec* when, uint when = &now; } - for (auto& feedback : m_vFeedbacks) { + for (auto const& feedback : m_vFeedbacks) { if (!feedback->surface) continue; - for (auto& data : m_vQueue) { + for (auto const& data : m_vQueue) { if (!data->surface || data->surface != feedback->surface) continue; diff --git a/src/protocols/PrimarySelection.cpp b/src/protocols/PrimarySelection.cpp index 4fede706..f1db2d65 100644 --- a/src/protocols/PrimarySelection.cpp +++ b/src/protocols/PrimarySelection.cpp @@ -38,7 +38,7 @@ void CPrimarySelectionOffer::sendData() { if (!source) return; - for (auto& m : source->mimes()) { + for (auto const& m : source->mimes()) { resource->sendOffer(m.c_str()); } } @@ -177,7 +177,7 @@ CPrimarySelectionManager::CPrimarySelectionManager(SP<CZwpPrimarySelectionDevice RESOURCE->self = RESOURCE; device = RESOURCE; - for (auto& s : sources) { + for (auto const& s : sources) { if (!s) continue; s->device = RESOURCE; @@ -272,7 +272,7 @@ void CPrimarySelectionProtocol::sendSelectionToDevice(SP<CPrimarySelectionDevice } void CPrimarySelectionProtocol::setSelection(SP<IDataSource> source) { - for (auto& o : m_vOffers) { + for (auto const& o : m_vOffers) { if (o->source && o->source->hasDnd()) continue; o->dead = true; @@ -321,7 +321,7 @@ void CPrimarySelectionProtocol::updateSelection() { } void CPrimarySelectionProtocol::onPointerFocus() { - for (auto& o : m_vOffers) { + for (auto const& o : m_vOffers) { o->dead = true; } diff --git a/src/protocols/RelativePointer.cpp b/src/protocols/RelativePointer.cpp index e4818758..16248c02 100644 --- a/src/protocols/RelativePointer.cpp +++ b/src/protocols/RelativePointer.cpp @@ -65,7 +65,7 @@ void CRelativePointerProtocol::sendRelativeMotion(uint64_t time, const Vector2D& const auto FOCUSED = g_pSeatManager->state.pointerFocusResource->client(); - for (auto& rp : m_vRelativePointers) { + for (auto const& rp : m_vRelativePointers) { if (FOCUSED != rp->client()) continue; diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp index 1559476b..63024541 100644 --- a/src/protocols/Screencopy.cpp +++ b/src/protocols/Screencopy.cpp @@ -155,7 +155,7 @@ void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_ lockedSWCursors = true; // TODO: make it per-monitor if (!PROTO::screencopy->m_bTimerArmed) { - for (auto& m : g_pCompositor->m_vMonitors) { + for (auto const& m : g_pCompositor->m_vMonitors) { g_pPointerManager->lockSoftwareForMonitor(m); } PROTO::screencopy->m_bTimerArmed = true; @@ -365,7 +365,7 @@ CScreencopyProtocol::CScreencopyProtocol(const wl_interface* iface, const int& v std::nullopt, [this](SP<CEventLoopTimer> self, void* data) { // TODO: make it per-monitor - for (auto& m : g_pCompositor->m_vMonitors) { + for (auto const& m : g_pCompositor->m_vMonitors) { g_pPointerManager->unlockSoftwareForMonitor(m); } m_bTimerArmed = false; @@ -411,7 +411,7 @@ void CScreencopyProtocol::onOutputCommit(CMonitor* pMonitor) { std::vector<WP<CScreencopyFrame>> framesToRemove; // share frame if correct output - for (auto& f : m_vFramesAwaitingWrite) { + for (auto const& f : m_vFramesAwaitingWrite) { if (!f->pMonitor || !f->buffer) { framesToRemove.push_back(f); continue; @@ -428,7 +428,7 @@ void CScreencopyProtocol::onOutputCommit(CMonitor* pMonitor) { framesToRemove.push_back(f); } - for (auto& f : framesToRemove) { + for (auto const& f : framesToRemove) { destroyResource(f.get()); } } diff --git a/src/protocols/SessionLock.cpp b/src/protocols/SessionLock.cpp index fe44face..b1f701bf 100644 --- a/src/protocols/SessionLock.cpp +++ b/src/protocols/SessionLock.cpp @@ -187,7 +187,7 @@ void CSessionLockProtocol::onGetLockSurface(CExtSessionLockV1* lock, uint32_t id auto PMONITOR = CWLOutputResource::fromResource(output)->monitor.get(); SP<CSessionLock> sessionLock; - for (auto& l : m_vLocks) { + for (auto const& l : m_vLocks) { if (l->resource.get() == lock) { sessionLock = l; break; diff --git a/src/protocols/ShortcutsInhibit.cpp b/src/protocols/ShortcutsInhibit.cpp index e4424ed7..308b385d 100644 --- a/src/protocols/ShortcutsInhibit.cpp +++ b/src/protocols/ShortcutsInhibit.cpp @@ -48,7 +48,7 @@ void CKeyboardShortcutsInhibitProtocol::onInhibit(CZwpKeyboardShortcutsInhibitMa SP<CWLSurfaceResource> surf = CWLSurfaceResource::fromResource(surface); const auto CLIENT = pMgr->client(); - for (auto& in : m_vInhibitors) { + for (auto const& in : m_vInhibitors) { if (in->surface() != surf) continue; @@ -74,7 +74,7 @@ bool CKeyboardShortcutsInhibitProtocol::isInhibited() { if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus.lock()); PWINDOW && PWINDOW->m_sWindowData.noShortcutsInhibit.valueOrDefault()) return false; - for (auto& in : m_vInhibitors) { + for (auto const& in : m_vInhibitors) { if (in->surface() != g_pCompositor->m_pLastFocus) continue; diff --git a/src/protocols/Tablet.cpp b/src/protocols/Tablet.cpp index b974152e..d7f741b9 100644 --- a/src/protocols/Tablet.cpp +++ b/src/protocols/Tablet.cpp @@ -96,7 +96,7 @@ bool CTabletPadV2Resource::good() { void CTabletPadV2Resource::sendData() { // this is dodgy as fuck. I hate wl_array. it's expanded wl_array_for_each because C++ would complain about the implicit casts - for (auto& p : pad->aq()->paths) { + for (auto const& p : pad->aq()->paths) { resource->sendPath(p.c_str()); } @@ -140,7 +140,7 @@ void CTabletV2Resource::sendData() { resource->sendName(tablet->deviceName.c_str()); resource->sendId(tablet->aq()->usbVendorID, tablet->aq()->usbProductID); - for (auto& p : tablet->aq()->paths) { + for (auto const& p : tablet->aq()->paths) { resource->sendPath(p.c_str()); } @@ -287,21 +287,21 @@ void CTabletSeat::sendTablet(SP<CTablet> tablet) { } void CTabletSeat::sendData() { - for (auto& tw : PROTO::tablet->tablets) { + for (auto const& tw : PROTO::tablet->tablets) { if (tw.expired()) continue; sendTablet(tw.lock()); } - for (auto& tw : PROTO::tablet->tools) { + for (auto const& tw : PROTO::tablet->tools) { if (tw.expired()) continue; sendTool(tw.lock()); } - for (auto& tw : PROTO::tablet->pads) { + for (auto const& tw : PROTO::tablet->pads) { if (tw.expired()) continue; @@ -367,7 +367,7 @@ void CTabletV2Protocol::onGetSeat(CZwpTabletManagerV2* pMgr, uint32_t id, wl_res } void CTabletV2Protocol::registerDevice(SP<CTablet> tablet) { - for (auto& s : m_vSeats) { + for (auto const& s : m_vSeats) { s->sendTablet(tablet); } @@ -375,7 +375,7 @@ void CTabletV2Protocol::registerDevice(SP<CTablet> tablet) { } void CTabletV2Protocol::registerDevice(SP<CTabletTool> tool) { - for (auto& s : m_vSeats) { + for (auto const& s : m_vSeats) { s->sendTool(tool); } @@ -383,7 +383,7 @@ void CTabletV2Protocol::registerDevice(SP<CTabletTool> tool) { } void CTabletV2Protocol::registerDevice(SP<CTabletPad> pad) { - for (auto& s : m_vSeats) { + for (auto const& s : m_vSeats) { s->sendPad(pad); } @@ -391,7 +391,7 @@ void CTabletV2Protocol::registerDevice(SP<CTabletPad> pad) { } void CTabletV2Protocol::unregisterDevice(SP<CTablet> tablet) { - for (auto& t : m_vTablets) { + for (auto const& t : m_vTablets) { if (t->tablet == tablet) { t->resource->sendRemoved(); t->inert = true; @@ -401,7 +401,7 @@ void CTabletV2Protocol::unregisterDevice(SP<CTablet> tablet) { } void CTabletV2Protocol::unregisterDevice(SP<CTabletTool> tool) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool == tool) { t->resource->sendRemoved(); t->inert = true; @@ -411,7 +411,7 @@ void CTabletV2Protocol::unregisterDevice(SP<CTabletTool> tool) { } void CTabletV2Protocol::unregisterDevice(SP<CTabletPad> pad) { - for (auto& t : m_vPads) { + for (auto const& t : m_vPads) { if (t->pad == pad) { t->resource->sendRemoved(); t->inert = true; @@ -426,7 +426,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() { std::erase_if(pads, [](const auto& e) { return e.expired(); }); // now we need to send removed events - for (auto& t : m_vTablets) { + for (auto const& t : m_vTablets) { if (!t->tablet.expired() || t->inert) continue; @@ -434,7 +434,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() { t->inert = true; } - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (!t->tool.expired() || t->inert) continue; @@ -448,7 +448,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() { t->inert = true; } - for (auto& t : m_vPads) { + for (auto const& t : m_vPads) { if (!t->pad.expired() || t->inert) continue; @@ -458,7 +458,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() { } void CTabletV2Protocol::pressure(SP<CTabletTool> tool, double value) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -468,7 +468,7 @@ void CTabletV2Protocol::pressure(SP<CTabletTool> tool, double value) { } void CTabletV2Protocol::distance(SP<CTabletTool> tool, double value) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -478,7 +478,7 @@ void CTabletV2Protocol::distance(SP<CTabletTool> tool, double value) { } void CTabletV2Protocol::rotation(SP<CTabletTool> tool, double value) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -488,7 +488,7 @@ void CTabletV2Protocol::rotation(SP<CTabletTool> tool, double value) { } void CTabletV2Protocol::slider(SP<CTabletTool> tool, double value) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -498,7 +498,7 @@ void CTabletV2Protocol::slider(SP<CTabletTool> tool, double value) { } void CTabletV2Protocol::wheel(SP<CTabletTool> tool, double value) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -508,7 +508,7 @@ void CTabletV2Protocol::wheel(SP<CTabletTool> tool, double value) { } void CTabletV2Protocol::tilt(SP<CTabletTool> tool, const Vector2D& value) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -518,7 +518,7 @@ void CTabletV2Protocol::tilt(SP<CTabletTool> tool, const Vector2D& value) { } void CTabletV2Protocol::up(SP<CTabletTool> tool) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -528,7 +528,7 @@ void CTabletV2Protocol::up(SP<CTabletTool> tool) { } void CTabletV2Protocol::down(SP<CTabletTool> tool) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -545,7 +545,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP SP<CTabletToolV2Resource> toolResource; SP<CTabletV2Resource> tabletResource; - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || t->resource->client() != CLIENT) continue; @@ -559,7 +559,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP toolResource = t; - for (auto& tab : m_vTablets) { + for (auto const& tab : m_vTablets) { if (tab->tablet != tablet) continue; @@ -587,7 +587,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP } void CTabletV2Protocol::proximityOut(SP<CTabletTool> tool) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -599,7 +599,7 @@ void CTabletV2Protocol::proximityOut(SP<CTabletTool> tool) { } void CTabletV2Protocol::buttonTool(SP<CTabletTool> tool, uint32_t button, uint32_t state) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -610,7 +610,7 @@ void CTabletV2Protocol::buttonTool(SP<CTabletTool> tool, uint32_t button, uint32 } void CTabletV2Protocol::motion(SP<CTabletTool> tool, const Vector2D& value) { - for (auto& t : m_vTools) { + for (auto const& t : m_vTools) { if (t->tool != tool || !t->current) continue; @@ -620,7 +620,7 @@ void CTabletV2Protocol::motion(SP<CTabletTool> tool, const Vector2D& value) { } void CTabletV2Protocol::mode(SP<CTabletPad> pad, uint32_t group, uint32_t mode, uint32_t timeMs) { - for (auto& t : m_vPads) { + for (auto const& t : m_vPads) { if (t->pad != pad) continue; if (t->groups.size() <= group) { @@ -633,7 +633,7 @@ void CTabletV2Protocol::mode(SP<CTabletPad> pad, uint32_t group, uint32_t mode, } void CTabletV2Protocol::buttonPad(SP<CTabletPad> pad, uint32_t button, uint32_t timeMs, uint32_t state) { - for (auto& t : m_vPads) { + for (auto const& t : m_vPads) { if (t->pad != pad) continue; t->resource->sendButton(timeMs, button, zwpTabletToolV2ButtonState{state}); diff --git a/src/protocols/TearingControl.cpp b/src/protocols/TearingControl.cpp index 7f3c0a18..66a4efd2 100644 --- a/src/protocols/TearingControl.cpp +++ b/src/protocols/TearingControl.cpp @@ -38,7 +38,7 @@ void CTearingControlProtocol::onControllerDestroy(CTearingControl* control) { } void CTearingControlProtocol::onWindowDestroy(PHLWINDOW pWindow) { - for (auto& c : m_vTearingControllers) { + for (auto const& c : m_vTearingControllers) { if (c->pWindow.lock() == pWindow) c->pWindow.reset(); } @@ -52,7 +52,7 @@ CTearingControl::CTearingControl(SP<CWpTearingControlV1> resource_, SP<CWLSurfac resource->setDestroy([this](CWpTearingControlV1* res) { PROTO::tearing->onControllerDestroy(this); }); resource->setSetPresentationHint([this](CWpTearingControlV1* res, wpTearingControlV1PresentationHint hint) { this->onHint(hint); }); - for (auto& w : g_pCompositor->m_vWindows) { + for (auto const& w : g_pCompositor->m_vWindows) { if (w->m_pWLSurface->resource() == surf_) { pWindow = w; break; diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp index 916f7395..b28a827a 100644 --- a/src/protocols/ToplevelExport.cpp +++ b/src/protocols/ToplevelExport.cpp @@ -369,7 +369,7 @@ void CToplevelExportProtocol::onOutputCommit(CMonitor* pMonitor) { std::vector<WP<CToplevelExportFrame>> framesToRemove; // share frame if correct output - for (auto& f : m_vFramesAwaitingWrite) { + for (auto const& f : m_vFramesAwaitingWrite) { if (!f->pWindow || !validMapped(f->pWindow)) { framesToRemove.push_back(f); continue; @@ -393,13 +393,13 @@ void CToplevelExportProtocol::onOutputCommit(CMonitor* pMonitor) { framesToRemove.push_back(f); } - for (auto& f : framesToRemove) { + for (auto const& f : framesToRemove) { destroyResource(f.get()); } } void CToplevelExportProtocol::onWindowUnmap(PHLWINDOW pWindow) { - for (auto& f : m_vFrames) { + for (auto const& f : m_vFrames) { if (f->pWindow == pWindow) f->pWindow.reset(); } diff --git a/src/protocols/VirtualKeyboard.cpp b/src/protocols/VirtualKeyboard.cpp index 27a4f248..bb51315d 100644 --- a/src/protocols/VirtualKeyboard.cpp +++ b/src/protocols/VirtualKeyboard.cpp @@ -108,7 +108,7 @@ void CVirtualKeyboardV1Resource::releasePressed() { timespec now; clock_gettime(CLOCK_MONOTONIC, &now); - for (auto& p : pressed) { + for (auto const& p : pressed) { events.key.emit(IKeyboard::SKeyEvent{ .timeMs = now.tv_sec * 1000 + now.tv_nsec / 1000000, .keycode = p, diff --git a/src/protocols/XDGOutput.cpp b/src/protocols/XDGOutput.cpp index 9c2c353c..5d620667 100644 --- a/src/protocols/XDGOutput.cpp +++ b/src/protocols/XDGOutput.cpp @@ -39,7 +39,7 @@ CXDGOutputProtocol::CXDGOutputProtocol(const wl_interface* iface, const int& ver static auto P2 = g_pHookSystem->hookDynamic("configReloaded", [this](void* self, SCallbackInfo& info, std::any param) { this->updateAllOutputs(); }); static auto P3 = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) { const auto PMONITOR = std::any_cast<CMonitor*>(param); - for (auto& o : m_vXDGOutputs) { + for (auto const& o : m_vXDGOutputs) { if (o->monitor == PMONITOR) o->monitor = nullptr; } @@ -84,7 +84,7 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32 } void CXDGOutputProtocol::updateAllOutputs() { - for (auto& o : m_vXDGOutputs) { + for (auto const& o : m_vXDGOutputs) { if (!o->monitor) continue; diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp index eaf5c333..39a511c3 100644 --- a/src/protocols/XDGShell.cpp +++ b/src/protocols/XDGShell.cpp @@ -388,7 +388,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas g_pCompositor->m_vWindows.emplace_back(CWindow::create(self.lock())); - for (auto& p : popups) { + for (auto const& p : popups) { if (!p) continue; events.newPopup.emit(p); @@ -714,7 +714,7 @@ CXDGShellProtocol::CXDGShellProtocol(const wl_interface* iface, const int& ver, grab->keyboard = true; grab->pointer = true; grab->setCallback([this]() { - for (auto& g : grabbed) { + for (auto const& g : grabbed) { g->done(); } grabbed.clear(); @@ -779,7 +779,7 @@ void CXDGShellProtocol::addOrStartGrab(SP<CXDGPopupResource> popup) { void CXDGShellProtocol::onPopupDestroy(WP<CXDGPopupResource> popup) { if (popup == grabOwner) { g_pSeatManager->setGrab(nullptr); - for (auto& g : grabbed) { + for (auto const& g : grabbed) { g->done(); } grabbed.clear(); diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp index 75f1e646..f7f6dcda 100644 --- a/src/protocols/core/Compositor.cpp +++ b/src/protocols/core/Compositor.cpp @@ -241,7 +241,7 @@ void CWLSurfaceResource::frame(timespec* now) { if (callbacks.empty()) return; - for (auto& c : callbacks) { + for (auto const& c : callbacks) { c->send(now); } @@ -257,7 +257,7 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> nodes, std std::vector<SP<CWLSurfaceResource>> nodes2; // first, gather all nodes below - for (auto& n : nodes) { + for (auto const& n : nodes) { std::erase_if(n->subsurfaces, [](const auto& e) { return e.expired(); }); // subsurfaces is sorted lowest -> highest for (auto const& c : n->subsurfaces) { @@ -310,7 +310,7 @@ std::pair<SP<CWLSurfaceResource>, Vector2D> CWLSurfaceResource::at(const Vector2 void* data) { ((std::vector<std::pair<SP<CWLSurfaceResource>, Vector2D>>*)data)->emplace_back(std::make_pair<>(surf, offset)); }, &surfs); - for (auto& [surf, pos] : surfs | std::views::reverse) { + for (auto const& [surf, pos] : surfs | std::views::reverse) { if (!allowsInput) { const auto BOX = CBox{pos, surf->current.size}; if (BOX.containsPoint(localCoords)) diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp index 943c790f..b7640af3 100644 --- a/src/protocols/core/DataDevice.cpp +++ b/src/protocols/core/DataDevice.cpp @@ -80,7 +80,7 @@ void CWLDataOfferResource::sendData() { resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE); } - for (auto& m : source->mimes()) { + for (auto const& m : source->mimes()) { LOGM(LOG, " | offer {:x} supports mime {}", (uintptr_t)this, m); resource->sendOffer(m.c_str()); } diff --git a/src/protocols/core/Output.cpp b/src/protocols/core/Output.cpp index bcf62fae..394dc8e2 100644 --- a/src/protocols/core/Output.cpp +++ b/src/protocols/core/Output.cpp @@ -65,7 +65,7 @@ CWLOutputProtocol::CWLOutputProtocol(const wl_interface* iface, const int& ver, IWaylandProtocol(iface, ver, name), monitor(pMonitor), szName(pMonitor->szName) { listeners.modeChanged = monitor->events.modeChanged.registerListener([this](std::any d) { - for (auto& o : m_vOutputs) { + for (auto const& o : m_vOutputs) { o->updateState(); } }); @@ -95,7 +95,7 @@ void CWLOutputProtocol::destroyResource(CWLOutputResource* resource) { } SP<CWLOutputResource> CWLOutputProtocol::outputResourceFrom(wl_client* client) { - for (auto& r : m_vOutputs) { + for (auto const& r : m_vOutputs) { if (r->client() != client) continue; diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp index f7764389..6ae0ddc4 100644 --- a/src/protocols/core/Seat.cpp +++ b/src/protocols/core/Seat.cpp @@ -525,7 +525,7 @@ void CWLSeatProtocol::updateCapabilities(uint32_t caps) { currentCaps = caps; - for (auto& s : m_vSeatResources) { + for (auto const& s : m_vSeatResources) { s->sendCapabilities(caps); } } @@ -534,7 +534,7 @@ void CWLSeatProtocol::updateKeymap() { if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD)) return; - for (auto& k : m_vKeyboards) { + for (auto const& k : m_vKeyboards) { k->sendKeymap(g_pSeatManager->keyboard.lock()); } } @@ -543,13 +543,13 @@ void CWLSeatProtocol::updateRepeatInfo(uint32_t rate, uint32_t delayMs) { if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD)) return; - for (auto& k : m_vKeyboards) { + for (auto const& k : m_vKeyboards) { k->repeatInfo(rate, delayMs); } } SP<CWLSeatResource> CWLSeatProtocol::seatResourceForClient(wl_client* client) { - for (auto& r : m_vSeatResources) { + for (auto const& r : m_vSeatResources) { if (r->client() == client) return r; } diff --git a/src/protocols/core/Shm.cpp b/src/protocols/core/Shm.cpp index 9996a607..b09326bd 100644 --- a/src/protocols/core/Shm.cpp +++ b/src/protocols/core/Shm.cpp @@ -171,7 +171,7 @@ CWLSHMResource::CWLSHMResource(SP<CWlShm> resource_) : resource(resource_) { }); // send a few supported formats. No need for any other I think? - for (auto& s : PROTO::shm->shmFormats) { + for (auto const& s : PROTO::shm->shmFormats) { resource->sendFormat((wl_shm_format)s); } } @@ -193,7 +193,7 @@ void CWLSHMProtocol::bindManager(wl_client* client, void* data, uint32_t ver, ui DRM_FORMAT_XBGR8888, DRM_FORMAT_ABGR8888, DRM_FORMAT_XRGB2101010, DRM_FORMAT_ARGB2101010, DRM_FORMAT_XBGR2101010, DRM_FORMAT_ABGR2101010, }; - for (auto& fmt : g_pHyprOpenGL->getDRMFormats()) { + for (auto const& fmt : g_pHyprOpenGL->getDRMFormats()) { if (std::find(supportedShmFourccFormats.begin(), supportedShmFourccFormats.end(), fmt.drmFormat) == supportedShmFourccFormats.end()) continue; diff --git a/src/protocols/core/Subcompositor.cpp b/src/protocols/core/Subcompositor.cpp index e0679eff..46e20305 100644 --- a/src/protocols/core/Subcompositor.cpp +++ b/src/protocols/core/Subcompositor.cpp @@ -22,7 +22,7 @@ CWLSubsurfaceResource::CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWL return; auto pushAboveIndex = [this](int idx) -> void { - for (auto& c : parent->subsurfaces) { + for (auto const& c : parent->subsurfaces) { if (c->zIndex >= idx) c->zIndex++; } @@ -53,7 +53,7 @@ CWLSubsurfaceResource::CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWL return; auto pushBelowIndex = [this](int idx) -> void { - for (auto& c : parent->subsurfaces) { + for (auto const& c : parent->subsurfaces) { if (c->zIndex <= idx) c->zIndex--; } |