aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/desktop
diff options
context:
space:
mode:
authorTom Englund <[email protected]>2024-08-26 17:25:39 +0200
committerGitHub <[email protected]>2024-08-26 17:25:39 +0200
commit8d6c18076f3268a6c85c6085d29f898267028101 (patch)
tree9db19e850b0a3e2c5d20d5ca2ad5f9878eca89b1 /src/desktop
parent9c5a37a797ea1f1829859ab5b07016b2f27f739c (diff)
downloadHyprland-8d6c18076f3268a6c85c6085d29f898267028101.tar.gz
Hyprland-8d6c18076f3268a6c85c6085d29f898267028101.zip
core: make most for loops use const references (#7527)
why not let the compiler optimise things for us at hyprspeeds when we can.
Diffstat (limited to 'src/desktop')
-rw-r--r--src/desktop/LayerSurface.cpp2
-rw-r--r--src/desktop/Window.cpp16
2 files changed, 9 insertions, 9 deletions
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp
index 8d13bf19..331dba9c 100644
--- a/src/desktop/LayerSurface.cpp
+++ b/src/desktop/LayerSurface.cpp
@@ -72,7 +72,7 @@ CLayerSurface::~CLayerSurface() {
g_pHyprRenderer->makeEGLCurrent();
std::erase_if(g_pHyprOpenGL->m_mLayerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == self.lock(); });
- for (auto& mon : g_pCompositor->m_vRealMonitors) {
+ for (auto const& mon : g_pCompositor->m_vRealMonitors) {
for (auto& lsl : mon->m_aLayerSurfaceLayers) {
std::erase_if(lsl, [this](auto& ls) { return ls.expired() || ls.get() == this; });
}
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index dcdcb573..64337097 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -252,7 +252,7 @@ void CWindow::updateWindowDecos() {
if (!m_bIsMapped || isHidden())
return;
- for (auto& wd : m_vDecosToRemove) {
+ for (auto const& wd : m_vDecosToRemove) {
for (auto it = m_dWindowDecorations.begin(); it != m_dWindowDecorations.end(); it++) {
if (it->get() == wd) {
g_pDecorationPositioner->uncacheDecoration(it->get());
@@ -270,11 +270,11 @@ void CWindow::updateWindowDecos() {
// make a copy because updateWindow can remove decos.
std::vector<IHyprWindowDecoration*> decos;
- for (auto& wd : m_dWindowDecorations) {
+ for (auto const& wd : m_dWindowDecorations) {
decos.push_back(wd.get());
}
- for (auto& wd : decos) {
+ for (auto const& wd : decos) {
if (std::find_if(m_dWindowDecorations.begin(), m_dWindowDecorations.end(), [wd](const auto& other) { return other.get() == wd; }) == m_dWindowDecorations.end())
continue;
wd->updateWindow(m_pSelf.lock());
@@ -454,7 +454,7 @@ PHLWINDOW CWindow::X11TransientFor() {
s = s->parent;
}
- for (auto& w : g_pCompositor->m_vWindows) {
+ for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_pXWaylandSurface != s)
continue;
return w;
@@ -464,7 +464,7 @@ PHLWINDOW CWindow::X11TransientFor() {
}
void CWindow::removeDecorationByType(eDecorationType type) {
- for (auto& wd : m_dWindowDecorations) {
+ for (auto const& wd : m_dWindowDecorations) {
if (wd->getDecorationType() == type)
m_vDecosToRemove.push_back(wd.get());
}
@@ -617,7 +617,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
int opacityIDX = 0;
- for (auto& r : vars) {
+ for (auto const& r : vars) {
if (r == "opacity")
continue;
@@ -770,7 +770,7 @@ void CWindow::updateDynamicRules() {
m_tags.removeDynamicTags();
m_vMatchedRules = g_pConfigManager->getMatchingRules(m_pSelf.lock());
- for (auto& r : m_vMatchedRules) {
+ for (auto const& r : m_vMatchedRules) {
applyDynamicRule(r);
}
@@ -881,7 +881,7 @@ void CWindow::destroyGroup() {
addresses += std::format("{:x},", (uintptr_t)curr.get());
} while (curr.get() != this);
- for (auto& w : members) {
+ for (auto const& w : members) {
if (w->m_sGroupData.head)
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(curr);
w->m_sGroupData.head = false;