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/desktop | |
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/desktop')
-rw-r--r-- | src/desktop/LayerSurface.cpp | 2 | ||||
-rw-r--r-- | src/desktop/Popup.cpp | 10 | ||||
-rw-r--r-- | src/desktop/Subsurface.cpp | 6 | ||||
-rw-r--r-- | src/desktop/Window.cpp | 16 | ||||
-rw-r--r-- | src/desktop/Workspace.cpp | 4 |
5 files changed, 19 insertions, 19 deletions
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp index 331dba9c..155a2605 100644 --- a/src/desktop/LayerSurface.cpp +++ b/src/desktop/LayerSurface.cpp @@ -366,7 +366,7 @@ void CLayerSurface::applyRules() { xray = -1; animationStyle.reset(); - for (auto& rule : g_pConfigManager->getMatchingRules(self.lock())) { + for (auto const& rule : g_pConfigManager->getMatchingRules(self.lock())) { if (rule.rule == "noanim") noAnimations = true; else if (rule.rule == "blur") diff --git a/src/desktop/Popup.cpp b/src/desktop/Popup.cpp index e48b7400..a4952ef7 100644 --- a/src/desktop/Popup.cpp +++ b/src/desktop/Popup.cpp @@ -251,7 +251,7 @@ void CPopup::recheckTree() { void CPopup::recheckChildrenRecursive() { auto cpy = m_vChildren; - for (auto& c : cpy) { + for (auto const& c : cpy) { c->onCommit(true); c->recheckChildrenRecursive(); } @@ -282,14 +282,14 @@ bool CPopup::visible() { } void CPopup::bfHelper(std::vector<CPopup*> nodes, std::function<void(CPopup*, void*)> fn, void* data) { - for (auto& n : nodes) { + for (auto const& n : nodes) { fn(n, data); } std::vector<CPopup*> nodes2; - for (auto& n : nodes) { - for (auto& c : n->m_vChildren) { + for (auto const& n : nodes) { + for (auto const& c : n->m_vChildren) { nodes2.push_back(c.get()); } } @@ -308,7 +308,7 @@ CPopup* CPopup::at(const Vector2D& globalCoords, bool allowsInput) { std::vector<CPopup*> popups; breadthfirst([](CPopup* popup, void* data) { ((std::vector<CPopup*>*)data)->push_back(popup); }, &popups); - for (auto& p : popups | std::views::reverse) { + for (auto const& p : popups | std::views::reverse) { if (!p->m_pResource) continue; diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp index 71ee16f0..64dd7cf5 100644 --- a/src/desktop/Subsurface.cpp +++ b/src/desktop/Subsurface.cpp @@ -65,7 +65,7 @@ void CSubsurface::checkSiblingDamage() { const double SCALE = m_pWindowParent.lock() && m_pWindowParent->m_bIsX11 ? 1.0 / m_pWindowParent->m_fX11SurfaceScaledBy : 1.0; - for (auto& n : m_pParent->m_vChildren) { + for (auto const& n : m_pParent->m_vChildren) { if (n.get() == this) continue; @@ -75,7 +75,7 @@ void CSubsurface::checkSiblingDamage() { } void CSubsurface::recheckDamageForSubsurfaces() { - for (auto& n : m_vChildren) { + for (auto const& n : m_vChildren) { const auto COORDS = n->coordsGlobal(); g_pHyprRenderer->damageSurface(n->m_pWLSurface->resource(), COORDS.x, COORDS.y); } @@ -183,7 +183,7 @@ Vector2D CSubsurface::coordsGlobal() { } void CSubsurface::initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface) { - for (auto& s : pSurface->subsurfaces) { + for (auto const& s : pSurface->subsurfaces) { if (!s || s->surface->hlSurface /* already assigned */) continue; onNewSubsurface(s.lock()); diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 64337097..582e96a0 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -296,7 +296,7 @@ void CWindow::removeWindowDeco(IHyprWindowDecoration* deco) { } void CWindow::uncacheWindowDecos() { - for (auto& wd : m_dWindowDecorations) { + for (auto const& wd : m_dWindowDecorations) { g_pDecorationPositioner->uncacheDecoration(wd.get()); } } @@ -305,7 +305,7 @@ bool CWindow::checkInputOnDecos(const eInputType type, const Vector2D& mouseCoor if (type != INPUT_TYPE_DRAG_END && hasPopupAt(mouseCoords)) return false; - for (auto& wd : m_dWindowDecorations) { + for (auto const& wd : m_dWindowDecorations) { if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT)) continue; @@ -337,7 +337,7 @@ pid_t CWindow::getPID() { } IHyprWindowDecoration* CWindow::getDecorationByType(eDecorationType type) { - for (auto& wd : m_dWindowDecorations) { + for (auto const& wd : m_dWindowDecorations) { if (wd->getDecorationType() == type) return wd.get(); } @@ -666,7 +666,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { return; } - for (auto& token : colorsAndAngles) { + for (auto const& token : colorsAndAngles) { // The first angle, or an explicit "0deg", splits the two gradients if (active && token.contains("deg")) { activeBorderGradient.m_fAngle = std::stoi(token.substr(0, token.size() - 3)) * (PI / 180.0); @@ -889,7 +889,7 @@ void CWindow::destroyGroup() { const bool GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked; g_pKeybindManager->m_bGroupsLocked = true; - for (auto& w : members) { + for (auto const& w : members) { g_pLayoutManager->getCurrentLayout()->onWindowCreated(w); w->updateWindowDecos(); } @@ -1282,7 +1282,7 @@ std::unordered_map<std::string, std::string> CWindow::getEnv() { CVarList envs(std::string{buffer.data(), buffer.size() - 1}, 0, '\n', true); - for (auto& e : envs) { + for (auto const& e : envs) { if (!e.contains('=')) continue; @@ -1511,7 +1511,7 @@ PHLWINDOW CWindow::getSwallower() { if (!currentPid) break; - for (auto& w : g_pCompositor->m_vWindows) { + for (auto const& w : g_pCompositor->m_vWindows) { if (!w->m_bIsMapped || w->isHidden()) continue; @@ -1536,7 +1536,7 @@ PHLWINDOW CWindow::getSwallower() { return candidates.at(0); // walk up the focus history and find the last focused - for (auto& w : g_pCompositor->m_vWindowFocusHistory) { + for (auto const& w : g_pCompositor->m_vWindowFocusHistory) { if (!w) continue; diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp index 72d9705e..35fc5727 100644 --- a/src/desktop/Workspace.cpp +++ b/src/desktop/Workspace.cpp @@ -94,7 +94,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) { // set floating windows offset callbacks m_vRenderOffset.setUpdateCallback([&](void*) { - for (auto& w : g_pCompositor->m_vWindows) { + for (auto const& w : g_pCompositor->m_vWindows) { if (!validMapped(w) || w->workspaceID() != m_iID) continue; @@ -386,7 +386,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) { bool wantsCountVisible = false; int flagCount = 0; - for (auto& flag : prop) { + for (auto const& flag : prop) { if (flag == 't' && wantsOnlyTiled == -1) { wantsOnlyTiled = 1; flagCount++; |