diff options
| author | Tom Englund <tomenglund26@gmail.com> | 2024-08-26 20:24:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-26 20:24:30 +0200 |
| commit | 72c7818ae66a18d126e2b4245d649fe3a93d3b8e (patch) | |
| tree | 194361ee0d4f92eea809b7904d39f02793c55e13 /src/managers/PointerManager.cpp | |
| parent | 1ea47950f4262ec1215087948c7275f8e0115af2 (diff) | |
misc: constify the remaining for loops (#7534)
now we roll loops at blazing constified speed.
Diffstat (limited to 'src/managers/PointerManager.cpp')
| -rw-r--r-- | src/managers/PointerManager.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 80f1ab4f..f0f74428 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -76,14 +76,14 @@ void CPointerManager::checkDefaultCursorWarp(SP<CMonitor> monitor, std::string m } void CPointerManager::lockSoftwareAll() { - for (auto& state : monitorStates) + for (auto const& state : monitorStates) state->softwareLocks++; updateCursorBackend(); } void CPointerManager::unlockSoftwareAll() { - for (auto& state : monitorStates) + for (auto const& state : monitorStates) state->softwareLocks--; updateCursorBackend(); @@ -261,7 +261,7 @@ void CPointerManager::resetCursorImage(bool apply) { damageIfSoftware(); if (currentCursorImage.surface) { - for (auto& m : g_pCompositor->m_vMonitors) { + for (auto const& m : g_pCompositor->m_vMonitors) { currentCursorImage.surface->resource()->leave(m); } @@ -306,7 +306,7 @@ void CPointerManager::resetCursorImage(bool apply) { void CPointerManager::updateCursorBackend() { static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors"); - for (auto& m : g_pCompositor->m_vMonitors) { + for (auto const& m : g_pCompositor->m_vMonitors) { auto state = stateFor(m); if (!m->m_bEnabled || !m->dpmsStatus) { @@ -600,7 +600,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) { // static auto INSIDE_LAYOUT = [this](const CBox& box) -> bool { - for (auto& b : currentMonitorLayout.monitorBoxes) { + for (auto const& b : currentMonitorLayout.monitorBoxes) { if (box.inside(b)) return true; } @@ -608,7 +608,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) { }; static auto INSIDE_LAYOUT_COORD = [this](const Vector2D& vec) -> bool { - for (auto& b : currentMonitorLayout.monitorBoxes) { + for (auto const& b : currentMonitorLayout.monitorBoxes) { if (b.containsPoint(vec)) return true; } @@ -619,7 +619,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) { Vector2D leader; float distanceSq = __FLT_MAX__; - for (auto& b : currentMonitorLayout.monitorBoxes) { + for (auto const& b : currentMonitorLayout.monitorBoxes) { auto p = b.closestPoint(vec); auto distSq = p.distanceSq(vec); @@ -673,7 +673,7 @@ void CPointerManager::damageIfSoftware() { static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors"); - for (auto& mw : monitorStates) { + for (auto const& mw : monitorStates) { if (mw->monitor.expired()) continue; @@ -748,7 +748,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) { if (POINTER->boundOutput == "entire") { // find x and y size of the entire space Vector2D bottomRight = {-9999999, -9999999}, topLeft = {9999999, 9999999}; - for (auto& m : g_pCompositor->m_vMonitors) { + for (auto const& m : g_pCompositor->m_vMonitors) { const auto EXTENT = m->logicalBox().extent(); const auto POS = m->logicalBox().pos(); if (EXTENT.x > bottomRight.x) @@ -787,7 +787,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) { void CPointerManager::onMonitorLayoutChange() { currentMonitorLayout.monitorBoxes.clear(); - for (auto& m : g_pCompositor->m_vMonitors) { + for (auto const& m : g_pCompositor->m_vMonitors) { if (m->isMirror() || !m->m_bEnabled) continue; |
