misc: constify the remaining for loops (#7534)

now we roll loops at blazing constified speed.
This commit is contained in:
Tom Englund 2024-08-26 20:24:30 +02:00 committed by GitHub
parent 1ea47950f4
commit 72c7818ae6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
79 changed files with 472 additions and 472 deletions

View File

@ -287,12 +287,12 @@ void instancesRequest(bool json) {
std::vector<SInstanceData> inst = instances();
if (!json) {
for (auto& el : inst) {
for (auto const& el : inst) {
result += std::format("instance {}:\n\ttime: {}\n\tpid: {}\n\twl socket: {}\n\n", el.id, el.time, el.pid, el.wlSocket);
}
} else {
result += '[';
for (auto& el : inst) {
for (auto const& el : inst) {
result += std::format(R"#(
{{
"instance": "{}",

View File

@ -49,7 +49,7 @@ void DataState::addNewPluginRepo(const SPluginRepository& repo) {
{"rev", repo.rev}
}}
};
for (auto& p : repo.plugins) {
for (auto const& p : repo.plugins) {
// copy .so to the good place
if (std::filesystem::exists(p.filename))
std::filesystem::copy_file(p.filename, PATH + "/" + p.name + ".so");

View File

@ -6,7 +6,7 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
auto manifest = toml::parse_file(path);
if (type == MANIFEST_HYPRLOAD) {
for (auto& [key, val] : manifest) {
for (auto const& [key, val] : manifest) {
if (key.str().ends_with(".build"))
continue;
@ -63,7 +63,7 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
}
}
for (auto& [key, val] : manifest) {
for (auto const& [key, val] : manifest) {
if (key.str() == "repository")
continue;

View File

@ -204,9 +204,9 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
progress.m_iSteps = 2;
progress.printMessageAbove(std::string{Colors::GREEN} + "" + Colors::RESET + " parsed manifest, found " + std::to_string(pManifest->m_vPlugins.size()) + " plugins:");
for (auto& pl : pManifest->m_vPlugins) {
for (auto const& pl : pManifest->m_vPlugins) {
std::string message = std::string{Colors::RESET} + "" + pl.name + " by ";
for (auto& a : pl.authors) {
for (auto const& a : pl.authors) {
message += a + ", ";
}
if (pl.authors.size() > 0) {
@ -222,7 +222,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
progress.printMessageAbove(std::string{Colors::RESET} + " → Manifest has " + std::to_string(pManifest->m_sRepository.commitPins.size()) + " pins, checking");
for (auto& [hl, plugin] : pManifest->m_sRepository.commitPins) {
for (auto const& [hl, plugin] : pManifest->m_sRepository.commitPins) {
if (hl != HLVER.hash)
continue;
@ -264,7 +264,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
progress.printMessageAbove(std::string{Colors::RESET} + " → Building " + p.name);
for (auto& bs : p.buildSteps) {
for (auto const& bs : p.buildSteps) {
std::string cmd = std::format("cd {} && PKG_CONFIG_PATH=\"{}/share/pkgconfig\" {}", m_szWorkingPluginDirectory, DataState::getHeadersPath(), bs);
out += " -> " + cmd + "\n" + execAndGet(cmd) + "\n";
}
@ -299,7 +299,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
repo.url = url;
repo.rev = rev;
repo.hash = repohash;
for (auto& p : pManifest->m_vPlugins) {
for (auto const& p : pManifest->m_vPlugins) {
repo.plugins.push_back(SPlugin{p.name, m_szWorkingPluginDirectory + "/" + p.output, false, p.failed});
}
DataState::addNewPluginRepo(repo);
@ -579,7 +579,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
const std::string USERNAME = getpwuid(getuid())->pw_name;
m_szWorkingPluginDirectory = "/tmp/hyprpm/" + USERNAME;
for (auto& repo : REPOS) {
for (auto const& repo : REPOS) {
bool update = forceUpdateAll;
progress.m_iSteps++;
@ -658,7 +658,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
progress.printMessageAbove(std::string{Colors::RESET} + " → Manifest has " + std::to_string(pManifest->m_sRepository.commitPins.size()) + " pins, checking");
for (auto& [hl, plugin] : pManifest->m_sRepository.commitPins) {
for (auto const& [hl, plugin] : pManifest->m_sRepository.commitPins) {
if (hl != HLVER.hash)
continue;
@ -679,7 +679,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
progress.printMessageAbove(std::string{Colors::RESET} + " → Building " + p.name);
for (auto& bs : p.buildSteps) {
for (auto const& bs : p.buildSteps) {
std::string cmd = std::format("cd {} && PKG_CONFIG_PATH=\"{}/share/pkgconfig\" {}", m_szWorkingPluginDirectory, DataState::getHeadersPath(), bs);
out += " -> " + cmd + "\n" + execAndGet(cmd) + "\n";
}
@ -709,7 +709,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
if (repohash.length() > 0)
repohash.pop_back();
newrepo.hash = repohash;
for (auto& p : pManifest->m_vPlugins) {
for (auto const& p : pManifest->m_vPlugins) {
const auto OLDPLUGINIT = std::find_if(repo.plugins.begin(), repo.plugins.end(), [&](const auto& other) { return other.name == p.name; });
newrepo.plugins.push_back(SPlugin{p.name, m_szWorkingPluginDirectory + "/" + p.output, OLDPLUGINIT != repo.plugins.end() ? OLDPLUGINIT->enabled : false});
}
@ -794,8 +794,8 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
const auto REPOS = DataState::getAllRepositories();
auto enabled = [REPOS](const std::string& plugin) -> bool {
for (auto& r : REPOS) {
for (auto& p : r.plugins) {
for (auto const& r : REPOS) {
for (auto const& p : r.plugins) {
if (p.name == plugin && p.enabled)
return true;
}
@ -805,8 +805,8 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
};
auto repoForName = [REPOS](const std::string& name) -> std::string {
for (auto& r : REPOS) {
for (auto& p : r.plugins) {
for (auto const& r : REPOS) {
for (auto const& p : r.plugins) {
if (p.name == name)
return r.name;
}
@ -816,7 +816,7 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
};
// unload disabled plugins
for (auto& p : loadedPlugins) {
for (auto const& p : loadedPlugins) {
if (!enabled(p)) {
// unload
loadUnloadPlugin(HYPRPMPATH + repoForName(p) + "/" + p + ".so", false);
@ -825,8 +825,8 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
}
// load enabled plugins
for (auto& r : REPOS) {
for (auto& p : r.plugins) {
for (auto const& r : REPOS) {
for (auto const& p : r.plugins) {
if (!p.enabled)
continue;
@ -855,10 +855,10 @@ bool CPluginManager::loadUnloadPlugin(const std::string& path, bool load) {
void CPluginManager::listAllPlugins() {
const auto REPOS = DataState::getAllRepositories();
for (auto& r : REPOS) {
for (auto const& r : REPOS) {
std::cout << std::string{Colors::RESET} + " → Repository " + r.name + ":\n";
for (auto& p : r.plugins) {
for (auto const& p : r.plugins) {
std::cout << std::string{Colors::RESET} + " │ Plugin " + p.name;
@ -905,7 +905,7 @@ std::string CPluginManager::headerErrorShort(const eHeadersErrors err) {
bool CPluginManager::hasDeps() {
std::vector<std::string> deps = {"meson", "cpio", "cmake", "pkg-config"};
for (auto& d : deps) {
for (auto const& d : deps) {
if (!execAndGet("command -v " + d).contains("/"))
return false;
}

View File

@ -391,7 +391,7 @@ void CCompositor::initAllSignals() {
m_bSessionActive = true;
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
scheduleFrameForMonitor(m.get());
g_pHyprRenderer->applyMonitorRule(m.get(), &m->activeMonitorRule, true);
}
@ -477,7 +477,7 @@ void CCompositor::cleanup() {
m_vWorkspaces.clear();
m_vWindows.clear();
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
g_pHyprOpenGL->destroyMonitorResources(m.get());
m->output->state->setEnabled(false);
@ -641,7 +641,7 @@ void CCompositor::removeLockFile() {
void CCompositor::prepareFallbackOutput() {
// create a backup monitor
SP<Aquamarine::IBackendImplementation> headless;
for (auto& impl : m_pAqBackend->getImplementations()) {
for (auto const& impl : m_pAqBackend->getImplementations()) {
if (impl->type() == Aquamarine::AQ_BACKEND_HEADLESS) {
headless = impl;
break;
@ -698,7 +698,7 @@ void CCompositor::startCompositor() {
}
CMonitor* CCompositor::getMonitorFromID(const MONITORID& id) {
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
if (m->ID == id) {
return m.get();
}
@ -708,7 +708,7 @@ CMonitor* CCompositor::getMonitorFromID(const MONITORID& id) {
}
CMonitor* CCompositor::getMonitorFromName(const std::string& name) {
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
if (m->szName == name) {
return m.get();
}
@ -717,7 +717,7 @@ CMonitor* CCompositor::getMonitorFromName(const std::string& name) {
}
CMonitor* CCompositor::getMonitorFromDesc(const std::string& desc) {
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
if (m->szDescription.starts_with(desc))
return m.get();
}
@ -730,7 +730,7 @@ CMonitor* CCompositor::getMonitorFromCursor() {
CMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) {
SP<CMonitor> mon;
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
if (CBox{m->vecPosition, m->vecSize}.containsPoint(point)) {
mon = m;
break;
@ -771,7 +771,7 @@ void CCompositor::removeWindowFromVectorSafe(PHLWINDOW pWindow) {
}
bool CCompositor::monitorExists(CMonitor* pMonitor) {
for (auto& m : m_vRealMonitors) {
for (auto const& m : m_vRealMonitors) {
if (m.get() == pMonitor)
return true;
}
@ -789,7 +789,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
// pinned windows on top of floating regardless
if (properties & ALLOW_FLOATING) {
for (auto& w : m_vWindows | std::views::reverse) {
for (auto const& w : m_vWindows | std::views::reverse) {
const auto BB = w->getWindowBoxUnified(properties);
CBox box = BB.copy().expand(w->m_iX11Type != 2 ? BORDER_GRAB_AREA : 0);
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() &&
@ -807,7 +807,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
auto windowForWorkspace = [&](bool special) -> PHLWINDOW {
auto floating = [&](bool aboveFullscreen) -> PHLWINDOW {
for (auto& w : m_vWindows | std::views::reverse) {
for (auto const& w : m_vWindows | std::views::reverse) {
if (special && !w->onSpecialWorkspace()) // because special floating may creep up into regular
continue;
@ -870,7 +870,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
return found;
// for windows, we need to check their extensions too, first.
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (special != w->onSpecialWorkspace())
continue;
@ -881,7 +881,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
}
}
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (special != w->onSpecialWorkspace())
continue;
@ -963,7 +963,7 @@ Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, PHLWINDOW pWindo
}
CMonitor* CCompositor::getMonitorFromOutput(SP<Aquamarine::IOutput> out) {
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
if (m->output == out) {
return m.get();
}
@ -973,7 +973,7 @@ CMonitor* CCompositor::getMonitorFromOutput(SP<Aquamarine::IOutput> out) {
}
CMonitor* CCompositor::getRealMonitorFromOutput(SP<Aquamarine::IOutput> out) {
for (auto& m : m_vRealMonitors) {
for (auto const& m : m_vRealMonitors) {
if (m->output == out) {
return m.get();
}
@ -1212,7 +1212,7 @@ PHLWINDOW CCompositor::getWindowFromSurface(SP<CWLSurfaceResource> pSurface) {
}
PHLWINDOW CCompositor::getWindowFromHandle(uint32_t handle) {
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if ((uint32_t)(((uint64_t)w.get()) & 0xFFFFFFFF) == handle) {
return w;
}
@ -1222,7 +1222,7 @@ PHLWINDOW CCompositor::getWindowFromHandle(uint32_t handle) {
}
PHLWINDOW CCompositor::getFullscreenWindowOnWorkspace(const WORKSPACEID& ID) {
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->workspaceID() == ID && w->isFullscreen())
return w;
}
@ -1246,7 +1246,7 @@ bool CCompositor::isWorkspaceVisibleNotCovered(PHLWORKSPACE w) {
}
PHLWORKSPACE CCompositor::getWorkspaceByID(const WORKSPACEID& id) {
for (auto& w : m_vWorkspaces) {
for (auto const& w : m_vWorkspaces) {
if (w->m_iID == id && !w->inert())
return w;
}
@ -1271,7 +1271,7 @@ void CCompositor::sanityCheckWorkspaces() {
int CCompositor::getWindowsOnWorkspace(const WORKSPACEID& id, std::optional<bool> onlyTiled, std::optional<bool> onlyVisible) {
int no = 0;
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->workspaceID() != id || !w->m_bIsMapped)
continue;
if (onlyTiled.has_value() && w->m_bIsFloating == onlyTiled.value())
@ -1286,7 +1286,7 @@ int CCompositor::getWindowsOnWorkspace(const WORKSPACEID& id, std::optional<bool
int CCompositor::getGroupsOnWorkspace(const WORKSPACEID& id, std::optional<bool> onlyTiled, std::optional<bool> onlyVisible) {
int no = 0;
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->workspaceID() != id || !w->m_bIsMapped)
continue;
if (!w->m_sGroupData.head)
@ -1301,7 +1301,7 @@ int CCompositor::getGroupsOnWorkspace(const WORKSPACEID& id, std::optional<bool>
}
PHLWINDOW CCompositor::getUrgentWindow() {
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->m_bIsMapped && w->m_bIsUrgent)
return w;
}
@ -1310,7 +1310,7 @@ PHLWINDOW CCompositor::getUrgentWindow() {
}
bool CCompositor::hasUrgentWindowOnWorkspace(const WORKSPACEID& id) {
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->workspaceID() == id && w->m_bIsMapped && w->m_bIsUrgent)
return true;
}
@ -1319,7 +1319,7 @@ bool CCompositor::hasUrgentWindowOnWorkspace(const WORKSPACEID& id) {
}
PHLWINDOW CCompositor::getFirstWindowOnWorkspace(const WORKSPACEID& id) {
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->workspaceID() == id && w->m_bIsMapped && !w->isHidden())
return w;
}
@ -1335,7 +1335,7 @@ PHLWINDOW CCompositor::getTopLeftWindowOnWorkspace(const WORKSPACEID& id) {
const auto PMONITOR = getMonitorFromID(PWORKSPACE->m_iMonitorID);
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->workspaceID() != id || !w->m_bIsMapped || w->isHidden())
continue;
@ -1400,7 +1400,7 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
else
toMove.emplace_front(pw);
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsX11 && w->X11TransientFor() == pw && w != pw && std::find(toMove.begin(), toMove.end(), w) == toMove.end()) {
x11Stack(w, top, x11Stack);
}
@ -1416,7 +1416,7 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
}
void CCompositor::cleanupFadingOut(const MONITORID& monid) {
for (auto& ww : m_vWindowsFadingOut) {
for (auto const& ww : m_vWindowsFadingOut) {
auto w = ww.lock();
@ -1441,7 +1441,7 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) {
bool layersDirty = false;
for (auto& lsr : m_vSurfacesFadingOut) {
for (auto const& lsr : m_vSurfacesFadingOut) {
auto ls = lsr.lock();
@ -1530,7 +1530,7 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
if (!pWindow->m_bIsFloating) {
// for tiled windows, we calc edges
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w == pWindow || !w->m_bIsMapped || w->isHidden() || (!w->isFullscreen() && w->m_bIsFloating) || !isWorkspaceVisible(w->m_pWorkspace))
continue;
@ -1622,7 +1622,7 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
float bestAngleAbs = 2.0 * M_PI;
constexpr float THRESHOLD = 0.3 * M_PI;
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w == pWindow || !w->m_bIsMapped || w->isHidden() || (!w->isFullscreen() && !w->m_bIsFloating) || !isWorkspaceVisible(w->m_pWorkspace))
continue;
@ -1660,7 +1660,7 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
PHLWINDOW CCompositor::getNextWindowOnWorkspace(PHLWINDOW pWindow, bool focusableOnly, std::optional<bool> floating) {
bool gotToWindow = false;
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w != pWindow && !gotToWindow)
continue;
@ -1676,7 +1676,7 @@ PHLWINDOW CCompositor::getNextWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
return w;
}
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (floating.has_value() && w->m_bIsFloating != floating.value())
continue;
@ -1689,7 +1689,7 @@ PHLWINDOW CCompositor::getNextWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
PHLWINDOW CCompositor::getPrevWindowOnWorkspace(PHLWINDOW pWindow, bool focusableOnly, std::optional<bool> floating) {
bool gotToWindow = false;
for (auto& w : m_vWindows | std::views::reverse) {
for (auto const& w : m_vWindows | std::views::reverse) {
if (w != pWindow && !gotToWindow)
continue;
@ -1705,7 +1705,7 @@ PHLWINDOW CCompositor::getPrevWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
return w;
}
for (auto& w : m_vWindows | std::views::reverse) {
for (auto const& w : m_vWindows | std::views::reverse) {
if (floating.has_value() && w->m_bIsFloating != floating.value())
continue;
@ -1727,7 +1727,7 @@ WORKSPACEID CCompositor::getNextAvailableNamedWorkspace() {
}
PHLWORKSPACE CCompositor::getWorkspaceByName(const std::string& name) {
for (auto& w : m_vWorkspaces) {
for (auto const& w : m_vWorkspaces) {
if (w->m_szName == name && !w->inert())
return w;
}
@ -1779,7 +1779,7 @@ CMonitor* CCompositor::getMonitorInDirection(CMonitor* pSourceMonitor, const cha
auto longestIntersect = -1;
CMonitor* longestIntersectMonitor = nullptr;
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
if (m == m_pLastMonitor)
continue;
@ -1843,7 +1843,7 @@ void CCompositor::updateAllWindowsAnimatedDecorationValues() {
}
void CCompositor::updateWorkspaceWindows(const int64_t& id) {
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (!w->m_bIsMapped || w->workspaceID() != id)
continue;
@ -1968,7 +1968,7 @@ void CCompositor::swapActiveWorkspaces(CMonitor* pMonitorA, CMonitor* pMonitorB)
PWORKSPACEA->m_iMonitorID = pMonitorB->ID;
PWORKSPACEA->moveToMonitor(pMonitorB->ID);
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->m_pWorkspace == PWORKSPACEA) {
if (w->m_bPinned) {
w->m_pWorkspace = PWORKSPACEB;
@ -1993,7 +1993,7 @@ void CCompositor::swapActiveWorkspaces(CMonitor* pMonitorA, CMonitor* pMonitorB)
PWORKSPACEB->m_iMonitorID = pMonitorA->ID;
PWORKSPACEB->moveToMonitor(pMonitorA->ID);
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->m_pWorkspace == PWORKSPACEB) {
if (w->m_bPinned) {
w->m_pWorkspace = PWORKSPACEA;
@ -2108,7 +2108,7 @@ CMonitor* CCompositor::getMonitorFromString(const std::string& name) {
return nullptr;
}
} else {
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
if (!m->output)
continue;
@ -2168,7 +2168,7 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, CMonitor* pMon
pWorkspace->m_iMonitorID = pMonitor->ID;
pWorkspace->moveToMonitor(pMonitor->ID);
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->m_pWorkspace == pWorkspace) {
if (w->m_bPinned) {
w->m_pWorkspace = g_pCompositor->getWorkspaceByID(nextWorkspaceOnMonitorID);
@ -2255,7 +2255,7 @@ void CCompositor::updateFullscreenFadeOnWorkspace(PHLWORKSPACE pWorkspace) {
const auto FULLSCREEN = pWorkspace->m_bHasFullscreenWindow;
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_pWorkspace == pWorkspace) {
if (w->m_bFadingOut || w->m_bPinned || w->isFullscreen())
@ -2347,7 +2347,7 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, sFullscreenS
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWINDOW->m_iMonitorID);
// make all windows on the same workspace under the fullscreen window
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->m_pWorkspace == PWORKSPACE && !w->isFullscreen() && !w->m_bFadingOut && !w->m_bPinned)
w->m_bCreatedOverFullscreen = false;
}
@ -2388,7 +2388,7 @@ PHLWINDOW CCompositor::getX11Parent(PHLWINDOW pWindow) {
}
void CCompositor::updateWorkspaceWindowDecos(const WORKSPACEID& id) {
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->workspaceID() != id)
continue;
@ -2400,7 +2400,7 @@ void CCompositor::updateWorkspaceWindowData(const WORKSPACEID& id) {
const auto PWORKSPACE = getWorkspaceByID(id);
const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{};
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->workspaceID() != id)
continue;
@ -2453,7 +2453,7 @@ PHLWINDOW CCompositor::getWindowByRegex(const std::string& regexp) {
const bool FLOAT = regexp.starts_with("floating");
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (!w->m_bIsMapped || w->m_bIsFloating != FLOAT || w->m_pWorkspace != m_pLastWindow->m_pWorkspace || w->isHidden())
continue;
@ -2463,7 +2463,7 @@ PHLWINDOW CCompositor::getWindowByRegex(const std::string& regexp) {
return nullptr;
}
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped || (w->isHidden() && !g_pLayoutManager->getCurrentLayout()->isWindowReachable(w)))
continue;
@ -2617,7 +2617,7 @@ Vector2D CCompositor::parseWindowVectorArgsRelative(const std::string& args, con
}
void CCompositor::forceReportSizesToWindowsOnWorkspace(const WORKSPACEID& wid) {
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w->workspaceID() == wid && w->m_bIsMapped && !w->isHidden()) {
g_pXWaylandManager->setWindowSize(w, w->m_vRealSize.value(), true);
}
@ -2744,7 +2744,7 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor
}
PHLWINDOW CCompositor::getForceFocus() {
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (!w->m_bIsMapped || w->isHidden() || !isWorkspaceVisible(w->m_pWorkspace))
continue;
@ -2763,7 +2763,7 @@ void CCompositor::arrangeMonitors() {
std::vector<CMonitor*> toArrange;
std::vector<CMonitor*> arranged;
for (auto& m : m_vMonitors)
for (auto const& m : m_vMonitors)
toArrange.push_back(m.get());
Debug::log(LOG, "arrangeMonitors: {} to arrange", toArrange.size());
@ -2795,7 +2795,7 @@ void CCompositor::arrangeMonitors() {
int maxYOffsetDown = 0;
// Finds the max and min values of explicitely placed monitors.
for (auto& m : arranged) {
for (auto const& m : arranged) {
if (m->vecPosition.x + m->vecSize.x > maxXOffsetRight)
maxXOffsetRight = m->vecPosition.x + m->vecSize.x;
if (m->vecPosition.x < maxXOffsetLeft)
@ -2807,7 +2807,7 @@ void CCompositor::arrangeMonitors() {
}
// Iterates through all non-explicitly placed monitors.
for (auto& m : toArrange) {
for (auto const& m : toArrange) {
// Moves the monitor to their appropriate position on the x/y axis and
// increments/decrements the corresponding max offset.
Vector2D newPosition = {0, 0};
@ -2838,7 +2838,7 @@ void CCompositor::arrangeMonitors() {
// reset maxXOffsetRight (reuse)
// and set xwayland positions aka auto for all
maxXOffsetRight = 0;
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
Debug::log(LOG, "arrangeMonitors: {} xwayland [{}, {}]", m->szName, maxXOffsetRight, 0);
m->vecXWaylandPosition = {maxXOffsetRight, 0};
maxXOffsetRight += (*PXWLFORCESCALEZERO ? m->vecTransformedSize.x : m->vecSize.x);
@ -2873,7 +2873,7 @@ void CCompositor::leaveUnsafeState() {
m_bUnsafeState = false;
CMonitor* pNewMonitor = nullptr;
for (auto& pMonitor : m_vMonitors) {
for (auto const& pMonitor : m_vMonitors) {
if (pMonitor->output != m_pUnsafeOutput->output) {
pNewMonitor = pMonitor.get();
break;
@ -2885,7 +2885,7 @@ void CCompositor::leaveUnsafeState() {
if (m_pUnsafeOutput->m_bEnabled)
m_pUnsafeOutput->onDisconnect();
for (auto& m : m_vMonitors) {
for (auto const& m : m_vMonitors) {
scheduleFrameForMonitor(m.get());
}
}
@ -2917,7 +2917,7 @@ void CCompositor::setPreferredTransformForSurface(SP<CWLSurfaceResource> pSurfac
}
void CCompositor::updateSuspendedStates() {
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped)
continue;
@ -2926,7 +2926,7 @@ void CCompositor::updateSuspendedStates() {
}
PHLWINDOW CCompositor::windowForCPointer(CWindow* pWindow) {
for (auto& w : m_vWindows) {
for (auto const& w : m_vWindows) {
if (w.get() != pWindow)
continue;
@ -2970,7 +2970,7 @@ void CCompositor::onNewMonitor(SP<Aquamarine::IOutput> output) {
g_pConfigManager->m_bWantsMonitorReload = true;
g_pCompositor->scheduleFrameForMonitor(PNEWMONITOR.get(), IOutput::AQ_SCHEDULE_NEW_MONITOR);
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_iMonitorID == PNEWMONITOR->ID) {
w->m_iLastSurfaceMonitorID = MONITOR_INVALID;
w->updateSurfaceScaleTransformDetails();

View File

@ -45,7 +45,7 @@ static Hyprlang::CParseResult configHandleGradientSet(const char* VALUE, void**
std::string parseError = "";
for (auto& var : varlist) {
for (auto const& var : varlist) {
if (var.find("deg") != std::string::npos) {
// last arg
try {
@ -863,7 +863,7 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
refreshGroupBarGradients();
// Updates dynamic window and workspace rules
for (auto& w : g_pCompositor->m_vWorkspaces) {
for (auto const& w : g_pCompositor->m_vWorkspaces) {
if (w->inert())
continue;
g_pCompositor->updateWorkspaceWindows(w->m_iID);
@ -891,7 +891,7 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
Debug::coloredLogs = reinterpret_cast<int64_t* const*>(m_pConfig->getConfigValuePtr("debug:colored_stdout_logs")->getDataStaticPtr());
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
// mark blur dirty
g_pHyprOpenGL->markBlurDirtyForMonitor(m.get());
@ -978,7 +978,7 @@ void CConfigManager::tick() {
bool parse = false;
for (auto& cf : configPaths) {
for (auto const& cf : configPaths) {
struct stat fileStat;
int err = stat(cf.c_str(), &fileStat);
if (err != 0) {
@ -1059,7 +1059,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const CMonitor& PMONITOR) {
SWorkspaceRule CConfigManager::getWorkspaceRuleFor(PHLWORKSPACE pWorkspace) {
SWorkspaceRule mergedRule{};
for (auto& rule : m_dWorkspaceRules) {
for (auto const& rule : m_dWorkspaceRules) {
if (!pWorkspace->matchesStaticSelector(rule.workspaceString))
continue;
@ -1132,7 +1132,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(PHLWINDOW pWindow, boo
// local tags for dynamic tag rule match
auto tags = pWindow->m_tags;
for (auto& rule : m_dWindowRules) {
for (auto const& rule : m_dWindowRules) {
// check if we have a matching rule
if (!rule.v2) {
try {
@ -1297,7 +1297,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(PHLWINDOW pWindow, boo
bool anyExecFound = false;
for (auto& er : execRequestedRules) {
for (auto const& er : execRequestedRules) {
if (std::ranges::any_of(PIDs, [&](const auto& pid) { return pid == er.iPid; })) {
returns.push_back({er.szRule, "execRule"});
anyExecFound = true;
@ -1317,7 +1317,7 @@ std::vector<SLayerRule> CConfigManager::getMatchingRules(PHLLS pLS) {
if (!pLS->layerSurface || pLS->fadingOut)
return returns;
for (auto& lr : m_dLayerRules) {
for (auto const& lr : m_dLayerRules) {
if (lr.targetNamespace.starts_with("address:0x")) {
if (std::format("address:0x{:x}", (uintptr_t)pLS.get()) != lr.targetNamespace)
continue;
@ -1391,7 +1391,7 @@ void CConfigManager::performMonitorReload() {
bool overAgain = false;
for (auto& m : g_pCompositor->m_vRealMonitors) {
for (auto const& m : g_pCompositor->m_vRealMonitors) {
if (!m->output || m->isUnsafeFallback)
continue;
@ -1448,7 +1448,7 @@ bool CConfigManager::shouldBlurLS(const std::string& ns) {
}
void CConfigManager::ensureMonitorStatus() {
for (auto& rm : g_pCompositor->m_vRealMonitors) {
for (auto const& rm : g_pCompositor->m_vRealMonitors) {
if (!rm->output || rm->isUnsafeFallback)
continue;
@ -1531,7 +1531,7 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
return;
}
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
ensureVRRForDisplay(m.get());
}
}
@ -1632,7 +1632,7 @@ void CConfigManager::removePluginConfig(HANDLE handle) {
}
std::erase_if(pluginKeywords, [&](const auto& other) { return other.handle == handle; });
for (auto& [h, n] : pluginVariables) {
for (auto const& [h, n] : pluginVariables) {
if (h != handle)
continue;
@ -2534,7 +2534,7 @@ std::optional<std::string> CConfigManager::handleWorkspaceRules(const std::strin
};
CVarList rulesList{rules, 0, ',', true};
for (auto& r : rulesList) {
for (auto const& r : rulesList) {
const auto R = assignRule(r);
if (R.has_value())
return R;

View File

@ -57,7 +57,7 @@ static std::string formatToString(uint32_t drmFormat) {
static std::string availableModesForOutput(CMonitor* pMonitor, eHyprCtlOutputFormat format) {
std::string result;
for (auto& m : pMonitor->output->modes) {
for (auto const& m : pMonitor->output->modes) {
if (format == FORMAT_NORMAL)
result += std::format("{}x{}@{:.2f}Hz ", m->pixelSize.x, m->pixelSize.y, m->refreshRate / 1000.0);
else
@ -445,13 +445,13 @@ std::string layersRequest(eHyprCtlOutputFormat format, std::string request) {
escapeJSONStrings(mon->szName));
int layerLevel = 0;
for (auto& level : mon->m_aLayerSurfaceLayers) {
for (auto const& level : mon->m_aLayerSurfaceLayers) {
result += std::format(
R"#(
"{}": [
)#",
layerLevel);
for (auto& layer : level) {
for (auto const& layer : level) {
result += std::format(
R"#( {{
"address": "0x{:x}",
@ -484,14 +484,14 @@ std::string layersRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\n}\n";
} else {
for (auto& mon : g_pCompositor->m_vMonitors) {
for (auto const& mon : g_pCompositor->m_vMonitors) {
result += std::format("Monitor {}:\n", mon->szName);
int layerLevel = 0;
static const std::array<std::string, 4> levelNames = {"background", "bottom", "top", "overlay"};
for (auto& level : mon->m_aLayerSurfaceLayers) {
for (auto const& level : mon->m_aLayerSurfaceLayers) {
result += std::format("\tLayer level {} ({}):\n", layerLevel, levelNames[layerLevel]);
for (auto& layer : level) {
for (auto const& layer : level) {
result += std::format("\t\tLayer {:x}: xywh: {} {} {} {}, namespace: {}\n", (uintptr_t)layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width,
layer->geometry.height, layer->szNamespace);
}
@ -510,7 +510,7 @@ std::string layoutsRequest(eHyprCtlOutputFormat format, std::string request) {
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
result += "[";
for (auto& m : g_pLayoutManager->getAllLayoutNames()) {
for (auto const& m : g_pLayoutManager->getAllLayoutNames()) {
result += std::format(
R"#(
"{}",)#",
@ -520,7 +520,7 @@ std::string layoutsRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\n]\n";
} else {
for (auto& m : g_pLayoutManager->getAllLayoutNames()) {
for (auto const& m : g_pLayoutManager->getAllLayoutNames()) {
result += std::format("{}\n", m);
}
}
@ -557,7 +557,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "{\n";
result += "\"mice\": [\n";
for (auto& m : g_pInputManager->m_vPointers) {
for (auto const& m : g_pInputManager->m_vPointers) {
result += std::format(
R"#( {{
"address": "0x{:x}",
@ -572,7 +572,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\n],\n";
result += "\"keyboards\": [\n";
for (auto& k : g_pInputManager->m_vKeyboards) {
for (auto const& k : g_pInputManager->m_vKeyboards) {
const auto KM = k->getActiveLayout();
result += std::format(
R"#( {{
@ -596,7 +596,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\"tablets\": [\n";
for (auto& d : g_pInputManager->m_vTabletPads) {
for (auto const& d : g_pInputManager->m_vTabletPads) {
result += std::format(
R"#( {{
"address": "0x{:x}",
@ -609,7 +609,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
(uintptr_t)d.get(), (uintptr_t)d->parent.get(), escapeJSONStrings(d->parent ? d->parent->hlName : ""));
}
for (auto& d : g_pInputManager->m_vTablets) {
for (auto const& d : g_pInputManager->m_vTablets) {
result += std::format(
R"#( {{
"address": "0x{:x}",
@ -618,7 +618,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
(uintptr_t)d.get(), escapeJSONStrings(d->hlName));
}
for (auto& d : g_pInputManager->m_vTabletTools) {
for (auto const& d : g_pInputManager->m_vTabletTools) {
result += std::format(
R"#( {{
"address": "0x{:x}",
@ -632,7 +632,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\"touch\": [\n";
for (auto& d : g_pInputManager->m_vTouches) {
for (auto const& d : g_pInputManager->m_vTouches) {
result += std::format(
R"#( {{
"address": "0x{:x}",
@ -646,7 +646,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\"switches\": [\n";
for (auto& d : g_pInputManager->m_lSwitches) {
for (auto const& d : g_pInputManager->m_lSwitches) {
result += std::format(
R"#( {{
"address": "0x{:x}",
@ -663,14 +663,14 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
} else {
result += "mice:\n";
for (auto& m : g_pInputManager->m_vPointers) {
for (auto const& m : g_pInputManager->m_vPointers) {
result += std::format("\tMouse at {:x}:\n\t\t{}\n\t\t\tdefault speed: {:.5f}\n", (uintptr_t)m.get(), m->hlName,
(m->aq() && m->aq()->getLibinputHandle() ? libinput_device_config_accel_get_default_speed(m->aq()->getLibinputHandle()) : 0.f));
}
result += "\n\nKeyboards:\n";
for (auto& k : g_pInputManager->m_vKeyboards) {
for (auto const& k : g_pInputManager->m_vKeyboards) {
const auto KM = k->getActiveLayout();
result += std::format("\tKeyboard at {:x}:\n\t\t{}\n\t\t\trules: r \"{}\", m \"{}\", l \"{}\", v \"{}\", o \"{}\"\n\t\t\tactive keymap: {}\n\t\t\tmain: {}\n",
(uintptr_t)k.get(), k->hlName, k->currentRules.rules, k->currentRules.model, k->currentRules.layout, k->currentRules.variant,
@ -679,27 +679,27 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\n\nTablets:\n";
for (auto& d : g_pInputManager->m_vTabletPads) {
for (auto const& d : g_pInputManager->m_vTabletPads) {
result += std::format("\tTablet Pad at {:x} (belongs to {:x} -> {})\n", (uintptr_t)d.get(), (uintptr_t)d->parent.get(), d->parent ? d->parent->hlName : "");
}
for (auto& d : g_pInputManager->m_vTablets) {
for (auto const& d : g_pInputManager->m_vTablets) {
result += std::format("\tTablet at {:x}:\n\t\t{}\n\t\t\tsize: {}x{}mm\n", (uintptr_t)d.get(), d->hlName, d->aq()->physicalSize.x, d->aq()->physicalSize.y);
}
for (auto& d : g_pInputManager->m_vTabletTools) {
for (auto const& d : g_pInputManager->m_vTabletTools) {
result += std::format("\tTablet Tool at {:x}\n", (uintptr_t)d.get());
}
result += "\n\nTouch:\n";
for (auto& d : g_pInputManager->m_vTouches) {
for (auto const& d : g_pInputManager->m_vTouches) {
result += std::format("\tTouch Device at {:x}:\n\t\t{}\n", (uintptr_t)d.get(), d->hlName);
}
result += "\n\nSwitches:\n";
for (auto& d : g_pInputManager->m_lSwitches) {
for (auto const& d : g_pInputManager->m_lSwitches) {
result += std::format("\tSwitch Device at {:x}:\n\t\t{}\n", (uintptr_t)&d, d.pDevice ? d.pDevice->getName() : "");
}
}
@ -712,21 +712,21 @@ std::string animationsRequest(eHyprCtlOutputFormat format, std::string request)
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
ret += "animations:\n";
for (auto& ac : g_pConfigManager->getAnimationConfig()) {
for (auto const& ac : g_pConfigManager->getAnimationConfig()) {
ret += std::format("\n\tname: {}\n\t\toverriden: {}\n\t\tbezier: {}\n\t\tenabled: {}\n\t\tspeed: {:.2f}\n\t\tstyle: {}\n", ac.first, (int)ac.second.overridden,
ac.second.internalBezier, ac.second.internalEnabled, ac.second.internalSpeed, ac.second.internalStyle);
}
ret += "beziers:\n";
for (auto& bz : g_pAnimationManager->getAllBeziers()) {
for (auto const& bz : g_pAnimationManager->getAllBeziers()) {
ret += std::format("\n\tname: {}\n", bz.first);
}
} else {
// json
ret += "[[";
for (auto& ac : g_pConfigManager->getAnimationConfig()) {
for (auto const& ac : g_pConfigManager->getAnimationConfig()) {
ret += std::format(R"#(
{{
"name": "{}",
@ -778,7 +778,7 @@ std::string globalShortcutsRequest(eHyprCtlOutputFormat format, std::string requ
std::string ret = "";
const auto SHORTCUTS = PROTO::globalShortcuts->getAllShortcuts();
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
for (auto& sh : SHORTCUTS)
for (auto const& sh : SHORTCUTS)
ret += std::format("{}:{} -> {}\n", sh.appid, sh.id, sh.description);
} else {
ret += "[";
@ -800,7 +800,7 @@ std::string globalShortcutsRequest(eHyprCtlOutputFormat format, std::string requ
std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
std::string ret = "";
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
for (auto& kb : g_pKeybindManager->m_lKeybinds) {
for (auto const& kb : g_pKeybindManager->m_lKeybinds) {
ret += "bind";
if (kb.locked)
ret += "l";
@ -821,7 +821,7 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
} else {
// json
ret += "[";
for (auto& kb : g_pKeybindManager->m_lKeybinds) {
for (auto const& kb : g_pKeybindManager->m_lKeybinds) {
ret += std::format(
R"#(
{{
@ -935,7 +935,7 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
result += "os-release: " + execAndGet("cat /etc/os-release") + "\n\n";
result += "plugins:\n";
for (auto& pl : g_pPluginSystem->getAllPlugins()) {
for (auto const& pl : g_pPluginSystem->getAllPlugins()) {
result += std::format(" {} by {} ver {}\n", pl->name, pl->author, pl->version);
}
@ -1006,7 +1006,7 @@ std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
// decorations will probably need a repaint
if (COMMAND.contains("decoration:") || COMMAND.contains("border") || COMMAND == "workspace" || COMMAND.contains("zoom_factor") || COMMAND == "source") {
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
g_pHyprRenderer->damageMonitor(m.get());
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
}
@ -1359,7 +1359,7 @@ std::string decorationRequest(eHyprCtlOutputFormat format, std::string request)
std::string result = "";
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
result += "[";
for (auto& wd : PWINDOW->m_dWindowDecorations) {
for (auto const& wd : PWINDOW->m_dWindowDecorations) {
result += "{\n\"decorationName\": \"" + wd->getDisplayName() + "\",\n\"priority\": " + std::to_string(wd->getPositioningInfo().priority) + "\n},";
}
@ -1367,7 +1367,7 @@ std::string decorationRequest(eHyprCtlOutputFormat format, std::string request)
result += "]";
} else {
result = +"Decoration\tPriority\n";
for (auto& wd : PWINDOW->m_dWindowDecorations) {
for (auto const& wd : PWINDOW->m_dWindowDecorations) {
result += wd->getDisplayName() + "\t" + std::to_string(wd->getPositioningInfo().priority) + "\n";
}
}
@ -1396,7 +1396,7 @@ std::string dispatchOutput(eHyprCtlOutputFormat format, std::string request) {
if (g_pCompositor->getMonitorFromName(vars[3]))
return "A real monitor already uses that name.";
for (auto& impl : g_pCompositor->m_pAqBackend->getImplementations() | std::views::reverse) {
for (auto const& impl : g_pCompositor->m_pAqBackend->getImplementations() | std::views::reverse) {
auto type = impl->type();
if (type == Aquamarine::AQ_BACKEND_HEADLESS && (vars[2] == "headless" || vars[2] == "auto")) {
@ -1464,7 +1464,7 @@ std::string dispatchPlugin(eHyprCtlOutputFormat format, std::string request) {
return "no plugins loaded";
std::string list = "";
for (auto& p : PLUGINS) {
for (auto const& p : PLUGINS) {
list += std::format("\nPlugin {} by {}:\n\tHandle: {:x}\n\tVersion: {}\n\tDescription: {}\n", p->name, p->author, (uintptr_t)p->m_pHandle, p->version, p->description);
}
@ -1673,7 +1673,7 @@ std::string CHyprCtl::getReply(std::string request) {
std::string result = "";
// parse exact cmds first, then non-exact.
for (auto& cmd : m_vCommands) {
for (auto const& cmd : m_vCommands) {
if (!cmd->exact)
continue;
@ -1684,7 +1684,7 @@ std::string CHyprCtl::getReply(std::string request) {
}
if (result.empty())
for (auto& cmd : m_vCommands) {
for (auto const& cmd : m_vCommands) {
if (cmd->exact)
continue;
@ -1715,7 +1715,7 @@ std::string CHyprCtl::getReply(std::string request) {
rd.blurFBDirty = true;
}
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
g_pHyprRenderer->damageMonitor(m.get());
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
}

View File

@ -217,7 +217,7 @@ void CHyprDebugOverlay::draw() {
// draw the things
int offsetY = 0;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
offsetY += m_mMonitorOverlays[m.get()].draw(offsetY);
offsetY += 5; // for padding between mons
}

View File

@ -44,7 +44,7 @@ void CHyprNotificationOverlay::addNotification(const std::string& text, const CC
PNOTIF->icon = icon;
PNOTIF->fontSize = fontSize;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
g_pCompositor->scheduleFrameForMonitor(m.get());
}
}
@ -87,7 +87,7 @@ CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
const auto iconBackendID = iconBackendFromLayout(layout);
const auto PBEZIER = g_pAnimationManager->getBezier("default");
for (auto& notif : m_dNotifications) {
for (auto const& notif : m_dNotifications) {
const auto ICONPADFORNOTIF = notif->icon == ICON_NONE ? 0 : ICON_PAD;
const auto FONTSIZE = std::clamp((int)(notif->fontSize * ((pMonitor->vecPixelSize.x * SCALE) / 1920.f)), 8, 40);

View File

@ -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")

View File

@ -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;

View File

@ -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());

View File

@ -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;

View File

@ -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++;

View File

@ -139,7 +139,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (PWINDOW->m_bWantsInitialFullscreen || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->fullscreen))
requestedClientFSMode = FSMODE_FULLSCREEN;
for (auto& r : PWINDOW->m_vMatchedRules) {
for (auto const& r : PWINDOW->m_vMatchedRules) {
if (r.szRule.starts_with("monitor")) {
try {
const auto MONITORSTR = trim(r.szRule.substr(r.szRule.find(' ')));
@ -326,7 +326,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_bCreatedOverFullscreen = true;
// size and move rules
for (auto& r : PWINDOW->m_vMatchedRules) {
for (auto const& r : PWINDOW->m_vMatchedRules) {
if (r.szRule.starts_with("size")) {
try {
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);

View File

@ -12,7 +12,7 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
m_dPoints.emplace_back(Vector2D(0, 0));
for (auto& p : *pVec) {
for (auto const& p : *pVec) {
m_dPoints.push_back(p);
}

View File

@ -252,7 +252,7 @@ DRMFormat FormatUtils::shmToDRM(SHMFormat shm) {
}
const SPixelFormat* FormatUtils::getPixelFormatFromDRM(DRMFormat drm) {
for (auto& fmt : GLES3_FORMATS) {
for (auto const& fmt : GLES3_FORMATS) {
if (fmt.drmFormat == drm)
return &fmt;
}
@ -261,7 +261,7 @@ const SPixelFormat* FormatUtils::getPixelFormatFromDRM(DRMFormat drm) {
}
const SPixelFormat* FormatUtils::getPixelFormatFromGL(uint32_t glFormat, uint32_t glType, bool alpha) {
for (auto& fmt : GLES3_FORMATS) {
for (auto const& fmt : GLES3_FORMATS) {
if (fmt.glFormat == (int)glFormat && fmt.glType == (int)glType && fmt.withAlpha == alpha)
return &fmt;
}

View File

@ -180,7 +180,7 @@ void handleNoop(struct wl_listener* listener, void* data) {
std::string escapeJSONStrings(const std::string& str) {
std::ostringstream oss;
for (auto& c : str) {
for (auto const& c : str) {
switch (c) {
case '"': oss << "\\\""; break;
case '\\': oss << "\\\\"; break;
@ -251,7 +251,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
std::set<WORKSPACEID> invalidWSes;
if (same_mon) {
for (auto& rule : g_pConfigManager->getAllWorkspaceRules()) {
for (auto const& rule : g_pConfigManager->getAllWorkspaceRules()) {
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
if (PMONITOR && (PMONITOR->ID != g_pCompositor->m_pLastMonitor->ID))
invalidWSes.insert(rule.workspaceId);
@ -301,13 +301,13 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
std::set<WORKSPACEID> invalidWSes;
// Collect all the workspaces we can't jump to.
for (auto& ws : g_pCompositor->m_vWorkspaces) {
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)) {
// Can't jump to this workspace
invalidWSes.insert(ws->m_iID);
}
}
for (auto& rule : g_pConfigManager->getAllWorkspaceRules()) {
for (auto const& rule : g_pConfigManager->getAllWorkspaceRules()) {
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
if (!PMONITOR || PMONITOR->ID == g_pCompositor->m_pLastMonitor->ID) {
// Can't be invalid
@ -319,7 +319,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
// Prepare all named workspaces in case when we need them
std::vector<WORKSPACEID> namedWSes;
for (auto& ws : g_pCompositor->m_vWorkspaces) {
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID) || ws->m_iID >= 0)
continue;
@ -463,7 +463,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
int remains = (int)result.id;
std::vector<WORKSPACEID> validWSes;
for (auto& ws : g_pCompositor->m_vWorkspaces) {
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID && !onAllMonitors))
continue;

View File

@ -171,7 +171,7 @@ void CMonitor::onConnect(bool noRule) {
setupDefaultWS(monitorRule);
for (auto& ws : g_pCompositor->m_vWorkspaces) {
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
if (!valid(ws))
continue;
@ -242,7 +242,7 @@ void CMonitor::onDisconnect(bool destroy) {
// Cleanup everything. Move windows back, snap cursor, shit.
CMonitor* BACKUPMON = nullptr;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (m.get() != this) {
BACKUPMON = m.get();
break;
@ -259,7 +259,7 @@ void CMonitor::onDisconnect(bool destroy) {
}
if (!mirrors.empty()) {
for (auto& m : mirrors) {
for (auto const& m : mirrors) {
m->setMirror("");
}
@ -298,13 +298,13 @@ void CMonitor::onDisconnect(bool destroy) {
// move workspaces
std::deque<PHLWORKSPACE> wspToMove;
for (auto& w : g_pCompositor->m_vWorkspaces) {
for (auto const& w : g_pCompositor->m_vWorkspaces) {
if (w->m_iMonitorID == ID || !g_pCompositor->getMonitorFromID(w->m_iMonitorID)) {
wspToMove.push_back(w);
}
}
for (auto& w : wspToMove) {
for (auto const& w : wspToMove) {
w->m_szLastMonitor = szName;
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
w->startAnim(true, true, true);
@ -332,7 +332,7 @@ void CMonitor::onDisconnect(bool destroy) {
int mostHz = 0;
CMonitor* pMonitorMostHz = nullptr;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (m->refreshRate > mostHz && m.get() != this) {
pMonitorMostHz = m.get();
mostHz = m->refreshRate;
@ -516,7 +516,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
g_pHyprRenderer->applyMonitorRule(this, (SMonitorRule*)&RULE, true); // will apply the offset and stuff
} else {
CMonitor* BACKUPMON = nullptr;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (m.get() != this) {
BACKUPMON = m.get();
break;
@ -525,13 +525,13 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
// move all the WS
std::deque<PHLWORKSPACE> wspToMove;
for (auto& w : g_pCompositor->m_vWorkspaces) {
for (auto const& w : g_pCompositor->m_vWorkspaces) {
if (w->m_iMonitorID == ID) {
wspToMove.push_back(w);
}
}
for (auto& w : wspToMove) {
for (auto const& w : wspToMove) {
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
w->startAnim(true, true, true);
}
@ -605,7 +605,7 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
pWorkspace->startAnim(true, ANIMTOLEFT);
// move pinned windows
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_pWorkspace == POLDWORKSPACE && w->m_bPinned)
w->moveToWorkspace(pWorkspace);
}
@ -714,7 +714,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
if (animate)
pWorkspace->startAnim(true, true);
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_pWorkspace == pWorkspace) {
w->m_iMonitorID = ID;
w->updateSurfaceScaleTransformDetails();

View File

@ -104,7 +104,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
CMonitor* PMONITOR = nullptr;
if (g_pCompositor->isWorkspaceSpecial(pNode->workspaceID)) {
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (m->activeSpecialWorkspaceID() == pNode->workspaceID) {
PMONITOR = m.get();
break;
@ -1075,7 +1075,7 @@ std::string CHyprDwindleLayout::getLayoutName() {
}
void CHyprDwindleLayout::onEnable() {
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
continue;

View File

@ -591,7 +591,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
if (pWindow->m_bIsFloating) {
// find whether there is a floating window below this one
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
!w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow) {
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x,
@ -611,7 +611,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
return PWINDOWCANDIDATE;
// if not, floating window
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
!w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow)
return w;
@ -660,7 +660,7 @@ void IHyprLayout::requestFocusForWindow(PHLWINDOW pWindow) {
Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // get all rules, see if we have any size overrides.
Vector2D sizeOverride = {};
if (g_pCompositor->m_pLastMonitor) {
for (auto& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
for (auto const& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
if (r.szRule.starts_with("size")) {
try {
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);

View File

@ -172,7 +172,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire
} else if (WINDOWSONWORKSPACE == 2) {
// when dropping as the second tiled window in the workspace,
// make it the master only if the cursor is on the master side of the screen
for (auto& nd : m_lMasterNodesData) {
for (auto const& nd : m_lMasterNodesData) {
if (nd.isMaster && nd.workspaceID == PNODE->workspaceID) {
switch (orientation) {
case ORIENTATION_LEFT:
@ -619,7 +619,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
CMonitor* PMONITOR = nullptr;
if (g_pCompositor->isWorkspaceSpecial(pNode->workspaceID)) {
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (m->activeSpecialWorkspaceID() == pNode->workspaceID) {
PMONITOR = m.get();
break;
@ -1106,7 +1106,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
const auto NEWFOCUS = newFocusToChild ? NEWCHILD : NEWMASTER;
switchToWindow(NEWFOCUS);
} else {
for (auto& n : m_lMasterNodesData) {
for (auto const& n : m_lMasterNodesData) {
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
const auto NEWMASTER = n.pWindow.lock();
switchWindows(NEWMASTER, NEWCHILD);
@ -1141,7 +1141,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
return 0;
} else {
// if master is focused keep master focused (don't do anything)
for (auto& n : m_lMasterNodesData) {
for (auto const& n : m_lMasterNodesData) {
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
switchToWindow(n.pWindow.lock());
break;
@ -1469,7 +1469,7 @@ Vector2D CHyprMasterLayout::predictSizeForNewWindowTiled() {
}
void CHyprMasterLayout::onEnable() {
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
continue;

View File

@ -70,7 +70,7 @@ void CAnimationManager::tick() {
std::vector<CBaseAnimatedVariable*> animationEndedVars;
for (auto& av : m_vActiveAnimatedVariables) {
for (auto const& av : m_vActiveAnimatedVariables) {
if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !*PSHADOWSENABLED) {
av->warp(false);
@ -113,7 +113,7 @@ void CAnimationManager::tick() {
g_pHyprRenderer->damageMonitor(PMONITOR);
// TODO: just make this into a damn callback already vax...
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PWORKSPACE)
continue;
@ -214,7 +214,7 @@ void CAnimationManager::tick() {
PWINDOW->updateWindowDecos();
g_pHyprRenderer->damageWindow(PWINDOW);
} else if (PWORKSPACE) {
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE)
continue;
@ -263,7 +263,7 @@ void CAnimationManager::tick() {
}
// do it here, because if this alters the animation vars deque we would be in trouble above.
for (auto& ave : animationEndedVars) {
for (auto const& ave : animationEndedVars) {
ave->onAnimationEnd();
}
}
@ -293,7 +293,7 @@ bool CAnimationManager::deltazero(const CColor& a, const CColor& b) {
}
bool CAnimationManager::bezierExists(const std::string& bezier) {
for (auto& [bc, bz] : m_mBezierCurves) {
for (auto const& [bc, bz] : m_mBezierCurves) {
if (bc == bezier)
return true;
}

View File

@ -193,7 +193,7 @@ void CCursorManager::setCursorFromName(const std::string& name) {
// fallback to a default if available
constexpr const std::array<const char*, 3> fallbackShapes = {"default", "left_ptr", "left-ptr"};
for (auto& s : fallbackShapes) {
for (auto const& s : fallbackShapes) {
m_sCurrentCursorShapeData = m_pHyprcursor->getShape(s, m_sCurrentStyleInfo);
if (m_sCurrentCursorShapeData.images.size() > 0)
@ -288,7 +288,7 @@ void CCursorManager::updateTheme() {
static auto PUSEHYPRCURSOR = CConfigValue<Hyprlang::INT>("cursor:enable_hyprcursor");
float highestScale = 1.0;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (m->scale > highestScale)
highestScale = m->scale;
}
@ -307,7 +307,7 @@ void CCursorManager::updateTheme() {
setCursorFromName("left_ptr");
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
m->forceFullFrames = 5;
g_pCompositor->scheduleFrameForMonitor(m.get(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE);
}

View File

@ -30,7 +30,7 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal
std::vector<HANDLE> faultyHandles;
volatile bool needsDeadCleanup = false;
for (auto& cb : *callbacks) {
for (auto const& cb : *callbacks) {
m_bCurrentEventPlugin = false;
@ -70,7 +70,7 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal
std::erase_if(*callbacks, [](const auto& fn) { return !fn.fn.lock(); });
if (!faultyHandles.empty()) {
for (auto& h : faultyHandles)
for (auto const& h : faultyHandles)
g_pPluginSystem->unloadPlugin(g_pPluginSystem->getPluginByHandle(h), true);
}
}

View File

@ -908,7 +908,7 @@ uint64_t CKeybindManager::spawnRawProc(std::string args) {
grandchild = fork();
if (grandchild == 0) {
// run in grandchild
for (auto& e : HLENV) {
for (auto const& e : HLENV) {
setenv(e.first.c_str(), e.second.c_str(), 1);
}
setenv("WAYLAND_DISPLAY", g_pCompositor->m_szWLDisplaySocket.c_str(), 1);
@ -1720,10 +1720,10 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
// we make a copy because changeWindowFloatingMode might invalidate the iterator
std::deque<PHLWINDOW> ptrs;
for (auto& w : g_pCompositor->m_vWindows)
for (auto const& w : g_pCompositor->m_vWindows)
ptrs.push_back(w);
for (auto& w : ptrs) {
for (auto const& w : ptrs) {
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE || w->isHidden())
continue;
@ -1895,7 +1895,7 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
auto specialOpenOnMonitor = PMONITOR->activeSpecialWorkspaceID();
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (m->activeSpecialWorkspaceID() == workspaceID) {
requestedWorkspaceIsAlreadyOpen = true;
break;
@ -1922,7 +1922,7 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
SDispatchResult CKeybindManager::forceRendererReload(std::string args) {
bool overAgain = false;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (!m->output)
continue;
@ -2390,7 +2390,7 @@ SDispatchResult CKeybindManager::dpms(std::string arg) {
if (arg.find_first_of(' ') != std::string::npos)
port = arg.substr(arg.find_first_of(' ') + 1);
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (!port.empty() && m->szName != port)
continue;

View File

@ -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;

View File

@ -151,7 +151,7 @@ CProtocolManager::CProtocolManager() {
PROTO::toplevelExport = std::make_unique<CToplevelExportProtocol>(&hyprland_toplevel_export_manager_v1_interface, 2, "ToplevelExport");
PROTO::globalShortcuts = std::make_unique<CGlobalShortcutsProtocol>(&hyprland_global_shortcuts_manager_v1_interface, 1, "GlobalShortcuts");
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;

View File

@ -483,7 +483,7 @@ void CSeatManager::refocusGrab() {
if (seatGrab->surfs.size() > 0) {
// try to find a surf in focus first
const auto MOUSE = g_pInputManager->getMouseCoordsInternal();
for (auto& s : seatGrab->surfs) {
for (auto const& s : seatGrab->surfs) {
auto hlSurf = CWLSurface::fromResource(s.lock());
if (!hlSurf)
continue;

View File

@ -67,7 +67,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
m_pSessionLock.reset();
g_pInputManager->refocus();
for (auto& m : g_pCompositor->m_vMonitors)
for (auto const& m : g_pCompositor->m_vMonitors)
g_pHyprRenderer->damageMonitor(m.get());
});
@ -75,7 +75,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
m_pSessionLock.reset();
g_pCompositor->focusSurface(nullptr);
for (auto& m : g_pCompositor->m_vMonitors)
for (auto const& m : g_pCompositor->m_vMonitors)
g_pHyprRenderer->damageMonitor(m.get());
});
@ -90,7 +90,7 @@ SSessionLockSurface* CSessionLockManager::getSessionLockSurfaceForMonitor(uint64
if (!m_pSessionLock)
return nullptr;
for (auto& sls : m_pSessionLock->vSessionLockSurfaces) {
for (auto const& sls : m_pSessionLock->vSessionLockSurfaces) {
if (sls->iMonitorID == id) {
if (sls->mapped)
return sls.get();

View File

@ -304,7 +304,7 @@ std::unordered_set<std::string> CXCursorManager::themePaths(std::string const& t
scanTheme(theme);
while (!inherits.empty()) {
auto oldInherits = inherits;
for (auto& i : oldInherits)
for (auto const& i : oldInherits)
scanTheme(i);
if (oldInherits.size() == inherits.size())

View File

@ -255,7 +255,7 @@ Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) {
CMonitor* pMonitor = nullptr;
double bestDistance = __FLT_MAX__;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
const auto SIZ = *PXWLFORCESCALEZERO ? m->vecTransformedSize : m->vecSize;
double distance =

View File

@ -19,7 +19,7 @@ CEventLoopManager::CEventLoopManager(wl_display* display, wl_event_loop* wlEvent
}
CEventLoopManager::~CEventLoopManager() {
for (auto& eventSource : m_sWayland.aqEventSources) {
for (auto const& eventSource : m_sWayland.aqEventSources) {
wl_event_source_remove(eventSource);
}
@ -46,7 +46,7 @@ void CEventLoopManager::enterLoop() {
m_sWayland.eventSource = wl_event_loop_add_fd(m_sWayland.loop, m_sTimers.timerfd, WL_EVENT_READABLE, timerWrite, nullptr);
aqPollFDs = g_pCompositor->m_pAqBackend->getPollFDs();
for (auto& fd : aqPollFDs) {
for (auto const& fd : aqPollFDs) {
m_sWayland.aqEventSources.emplace_back(wl_event_loop_add_fd(m_sWayland.loop, fd->fd, WL_EVENT_READABLE, aquamarineFDWrite, fd.get()));
}
@ -56,7 +56,7 @@ void CEventLoopManager::enterLoop() {
}
void CEventLoopManager::onTimerFire() {
for (auto& t : m_sTimers.timers) {
for (auto const& t : m_sTimers.timers) {
if (t.strongRef() > 1 /* if it's 1, it was lost. Don't call it. */ && t->passed() && !t->cancelled())
t->call(t);
}
@ -93,7 +93,7 @@ void CEventLoopManager::nudgeTimers() {
long nextTimerUs = 10 * 1000 * 1000; // 10s
for (auto& t : m_sTimers.timers) {
for (auto const& t : m_sTimers.timers) {
if (const auto µs = t->leftUs(); µs < nextTimerUs)
nextTimerUs = µs;
}
@ -122,7 +122,7 @@ void CEventLoopManager::doLater(const std::function<void()>& fn) {
auto cpy = IDLE->fns;
IDLE->fns.clear();
IDLE->eventSource = nullptr;
for (auto& c : cpy) {
for (auto const& c : cpy) {
if (c)
c();
}

View File

@ -49,7 +49,7 @@ void CInputManager::recheckIdleInhibitorStatus() {
}
// check manual user-set inhibitors
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_eIdleInhibitMode == IDLEINHIBIT_NONE)
continue;

View File

@ -1033,7 +1033,7 @@ void CInputManager::setupMouse(SP<IPointer> mauz) {
}
void CInputManager::setPointerConfigs() {
for (auto& m : m_vPointers) {
for (auto const& m : m_vPointers) {
auto devname = m->hlName;
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
@ -1268,7 +1268,7 @@ void CInputManager::updateKeyboardsLeds(SP<IKeyboard> pKeyboard) {
if (!leds.has_value())
return;
for (auto& k : m_vKeyboards) {
for (auto const& k : m_vKeyboards) {
k->updateLEDs(leds.value());
}
}
@ -1402,7 +1402,7 @@ void CInputManager::unconstrainMouse() {
if (g_pSeatManager->mouse.expired())
return;
for (auto& c : m_vConstraints) {
for (auto const& c : m_vConstraints) {
const auto C = c.lock();
if (!C)
@ -1416,7 +1416,7 @@ void CInputManager::unconstrainMouse() {
}
bool CInputManager::isConstrained() {
for (auto& c : m_vConstraints) {
for (auto const& c : m_vConstraints) {
const auto C = c.lock();
if (!C)
@ -1434,7 +1434,7 @@ bool CInputManager::isConstrained() {
void CInputManager::updateCapabilities() {
uint32_t caps = 0;
for (auto& h : m_vHIDs) {
for (auto const& h : m_vHIDs) {
if (h.expired())
continue;
@ -1449,7 +1449,7 @@ uint32_t CInputManager::accumulateModsFromAllKBs() {
uint32_t finalMask = 0;
for (auto& kb : m_vKeyboards) {
for (auto const& kb : m_vKeyboards) {
if (kb->isVirtual() && shouldIgnoreVirtualKeyboard(kb))
continue;
@ -1464,7 +1464,7 @@ uint32_t CInputManager::accumulateModsFromAllKBs() {
void CInputManager::disableAllKeyboards(bool virt) {
for (auto& k : m_vKeyboards) {
for (auto const& k : m_vKeyboards) {
if (k->isVirtual() != virt)
continue;
@ -1540,13 +1540,13 @@ void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) {
return;
}
for (auto& m : m_vTouches) {
for (auto const& m : m_vTouches) {
setConfig(m);
}
}
void CInputManager::setTabletConfigs() {
for (auto& t : m_vTablets) {
for (auto const& t : m_vTablets) {
if (t->aq()->getLibinputHandle()) {
const auto NAME = t->hlName;
const auto LIBINPUTDEV = t->aq()->getLibinputHandle();
@ -1711,7 +1711,7 @@ void CInputManager::setCursorIconOnBorder(PHLWINDOW w) {
bool onDeco = false;
for (auto& wd : w->m_dWindowDecorations) {
for (auto const& wd : w->m_dWindowDecorations) {
if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
continue;

View File

@ -57,7 +57,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
if (!g_pCompositor->m_pLastFocus)
return;
for (auto& ti : m_vTextInputs) {
for (auto const& ti : m_vTextInputs) {
if (ti->client() != g_pCompositor->m_pLastFocus->client())
continue;
@ -80,7 +80,7 @@ CTextInput* CInputMethodRelay::getFocusedTextInput() {
if (!g_pCompositor->m_pLastFocus)
return nullptr;
for (auto& ti : m_vTextInputs) {
for (auto const& ti : m_vTextInputs) {
if (ti->focusedSurface() == g_pCompositor->m_pLastFocus)
return ti.get();
}
@ -101,7 +101,7 @@ void CInputMethodRelay::removeTextInput(CTextInput* pInput) {
}
void CInputMethodRelay::updateAllPopups() {
for (auto& p : m_vIMEPopups) {
for (auto const& p : m_vIMEPopups) {
p->onCommit();
}
}
@ -138,7 +138,7 @@ void CInputMethodRelay::onKeyboardFocus(SP<CWLSurfaceResource> pSurface) {
m_pLastKbFocus = pSurface;
for (auto& ti : m_vTextInputs) {
for (auto const& ti : m_vTextInputs) {
if (!ti->focusedSurface())
continue;
@ -148,7 +148,7 @@ void CInputMethodRelay::onKeyboardFocus(SP<CWLSurfaceResource> pSurface) {
if (!pSurface)
return;
for (auto& ti : m_vTextInputs) {
for (auto const& ti : m_vTextInputs) {
if (!ti->isV3())
continue;
@ -160,7 +160,7 @@ void CInputMethodRelay::onKeyboardFocus(SP<CWLSurfaceResource> pSurface) {
}
CInputPopup* CInputMethodRelay::popupFromCoords(const Vector2D& point) {
for (auto& p : m_vIMEPopups) {
for (auto const& p : m_vIMEPopups) {
if (p->isVecInPopup(point))
return p.get();
}
@ -169,7 +169,7 @@ CInputPopup* CInputMethodRelay::popupFromCoords(const Vector2D& point) {
}
CInputPopup* CInputMethodRelay::popupFromSurface(const SP<CWLSurfaceResource> surface) {
for (auto& p : m_vIMEPopups) {
for (auto const& p : m_vIMEPopups) {
if (p->getSurface() == surface)
return p.get();
}

View File

@ -229,7 +229,7 @@ void CInputManager::newTablet(SP<Aquamarine::ITablet> pDevice) {
SP<CTabletTool> CInputManager::ensureTabletToolPresent(SP<Aquamarine::ITabletTool> pTool) {
for (auto& t : m_vTabletTools) {
for (auto const& t : m_vTabletTools) {
if (t->aq() == pTool)
return t;
}

View File

@ -124,8 +124,8 @@ APICALL bool HyprlandAPI::removeWindowDecoration(HANDLE handle, IHyprWindowDecor
if (!PLUGIN)
return false;
for (auto& w : g_pCompositor->m_vWindows) {
for (auto& d : w->m_dWindowDecorations) {
for (auto const& w : g_pCompositor->m_vWindows) {
for (auto const& d : w->m_dWindowDecorations) {
if (d.get() == pDecoration) {
w->removeWindowDeco(pDecoration);
return true;

View File

@ -98,27 +98,27 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
exitFunc();
}
for (auto& [k, v] : plugin->registeredCallbacks) {
for (auto const& [k, v] : plugin->registeredCallbacks) {
if (const auto SHP = v.lock())
g_pHookSystem->unhook(SHP);
}
const auto ls = plugin->registeredLayouts;
for (auto& l : ls)
for (auto const& l : ls)
g_pLayoutManager->removeLayout(l);
g_pFunctionHookSystem->removeAllHooksFrom(plugin->m_pHandle);
const auto rd = plugin->registeredDecorations;
for (auto& d : rd)
for (auto const& d : rd)
HyprlandAPI::removeWindowDecoration(plugin->m_pHandle, d);
const auto rdi = plugin->registeredDispatchers;
for (auto& d : rdi)
for (auto const& d : rdi)
HyprlandAPI::removeDispatcher(plugin->m_pHandle, d);
const auto rhc = plugin->registeredHyprctlCommands;
for (auto& c : rhc)
for (auto const& c : rhc)
HyprlandAPI::unregisterHyprCtlCommand(plugin->m_pHandle, c);
g_pConfigManager->removePluginConfig(plugin->m_pHandle);
@ -139,7 +139,7 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
}
void CPluginSystem::unloadAllPlugins() {
for (auto& p : m_vLoadedPlugins | std::views::reverse)
for (auto const& p : m_vLoadedPlugins | std::views::reverse)
unloadPlugin(p.get(), false); // Unload remaining plugins gracefully
}
@ -147,7 +147,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st
std::vector<std::string> failures;
// unload all plugins that are no longer present
for (auto& p : m_vLoadedPlugins | std::views::reverse) {
for (auto const& p : m_vLoadedPlugins | std::views::reverse) {
if (p->m_bLoadedWithConfig && std::find(plugins.begin(), plugins.end(), p->path) == plugins.end()) {
Debug::log(LOG, "Unloading plugin {} which is no longer present in config", p->path);
unloadPlugin(p.get(), false);
@ -156,7 +156,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st
}
// load all new plugins
for (auto& path : plugins) {
for (auto const& path : plugins) {
if (std::find_if(m_vLoadedPlugins.begin(), m_vLoadedPlugins.end(), [&](const auto& other) { return other->path == path; }) == m_vLoadedPlugins.end()) {
Debug::log(LOG, "Loading plugin {} which is now present in config", path);
const auto plugin = loadPlugin(path);
@ -173,7 +173,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st
}
CPlugin* CPluginSystem::getPluginByPath(const std::string& path) {
for (auto& p : m_vLoadedPlugins) {
for (auto const& p : m_vLoadedPlugins) {
if (p->path == path)
return p.get();
}
@ -182,7 +182,7 @@ CPlugin* CPluginSystem::getPluginByPath(const std::string& path) {
}
CPlugin* CPluginSystem::getPluginByHandle(HANDLE handle) {
for (auto& p : m_vLoadedPlugins) {
for (auto const& p : m_vLoadedPlugins) {
if (p->m_pHandle == handle)
return p.get();
}

View File

@ -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();
}

View File

@ -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;

View File

@ -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;

View File

@ -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));
}
});

View File

@ -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;

View File

@ -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");

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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();
}
}

View File

@ -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)

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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());
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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});

View File

@ -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;

View File

@ -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();
}

View File

@ -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,

View File

@ -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;

View File

@ -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();

View File

@ -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))

View File

@ -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());
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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--;
}

View File

@ -213,7 +213,7 @@ EGLDeviceEXT CHyprOpenGLImpl::eglDeviceFromDRMFD(int drmFD) {
return EGL_NO_DEVICE_EXT;
}
for (auto& d : devices) {
for (auto const& d : devices) {
auto devName = m_sProc.eglQueryDeviceStringEXT(d, EGL_DRM_DEVICE_FILE_EXT);
if (!devName)
continue;
@ -435,7 +435,7 @@ void CHyprOpenGLImpl::initDRMFormats() {
std::vector<SDRMFormat> dmaFormats;
for (auto& fmt : formats) {
for (auto const& fmt : formats) {
std::vector<uint64_t> mods;
if (!DISABLE_MODS) {
auto ret = getModsForFormat(fmt);
@ -460,7 +460,7 @@ void CHyprOpenGLImpl::initDRMFormats() {
auto fmtName = drmGetFormatName(fmt);
Debug::log(LOG, "EGL: GPU Supports Format {} (0x{:x})", fmtName ? fmtName : "?unknown?", fmt);
for (auto& mod : mods) {
for (auto const& mod : mods) {
auto modName = drmGetFormatModifierName(mod);
modifierData.emplace_back(std::make_pair<>(mod, modName ? modName : "?unknown?"));
free(modName);
@ -476,7 +476,7 @@ void CHyprOpenGLImpl::initDRMFormats() {
return true;
});
for (auto& [m, name] : modifierData) {
for (auto const& [m, name] : modifierData) {
Debug::log(LOG, "EGL: | with modifier {} (0x{:x})", name, m);
mods.emplace_back(m);
}
@ -654,7 +654,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
if (!pMonitor->solitaryClient.expired())
return false;
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
const auto XRAYMODE = ls->xray == -1 ? *PXRAY : ls->xray;
if (ls->forceBlur && !XRAYMODE)
return true;
@ -663,7 +663,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
return true;
}
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
const auto XRAYMODE = ls->xray == -1 ? *PXRAY : ls->xray;
if (ls->forceBlur && !XRAYMODE)
return true;
@ -673,7 +673,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
}
// these two block optimization
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
if (ls->forceBlur)
return true;
@ -681,7 +681,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
return true;
}
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
if (ls->forceBlur)
return true;
@ -704,7 +704,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
if (*PXRAY)
return false;
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped || w->isHidden())
continue;
@ -1168,7 +1168,7 @@ void CHyprOpenGLImpl::clear(const CColor& color) {
glClearColor(color.r, color.g, color.b, color.a);
if (!m_RenderData.damage.empty()) {
for (auto& RECT : m_RenderData.damage.getRects()) {
for (auto const& RECT : m_RenderData.damage.getRects()) {
scissor(&RECT);
glClear(GL_COLOR_BUFFER_BIT);
}
@ -1327,13 +1327,13 @@ void CHyprOpenGLImpl::renderRectWithDamage(CBox* box, const CColor& col, CRegion
damageClip.intersect(*damage);
if (!damageClip.empty()) {
for (auto& RECT : damageClip.getRects()) {
for (auto const& RECT : damageClip.getRects()) {
scissor(&RECT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}
} else {
for (auto& RECT : damage->getRects()) {
for (auto const& RECT : damage->getRects()) {
scissor(&RECT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@ -1523,13 +1523,13 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, CBox* pB
damageClip.intersect(*damage);
if (!damageClip.empty()) {
for (auto& RECT : damageClip.getRects()) {
for (auto const& RECT : damageClip.getRects()) {
scissor(&RECT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}
} else {
for (auto& RECT : damage->getRects()) {
for (auto const& RECT : damage->getRects()) {
scissor(&RECT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@ -1582,7 +1582,7 @@ void CHyprOpenGLImpl::renderTexturePrimitive(SP<CTexture> tex, CBox* pBox) {
glEnableVertexAttribArray(shader->posAttrib);
glEnableVertexAttribArray(shader->texAttrib);
for (auto& RECT : m_RenderData.damage.getRects()) {
for (auto const& RECT : m_RenderData.damage.getRects()) {
scissor(&RECT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@ -1640,7 +1640,7 @@ void CHyprOpenGLImpl::renderTextureMatte(SP<CTexture> tex, CBox* pBox, CFramebuf
glEnableVertexAttribArray(shader->posAttrib);
glEnableVertexAttribArray(shader->texAttrib);
for (auto& RECT : m_RenderData.damage.getRects()) {
for (auto const& RECT : m_RenderData.damage.getRects()) {
scissor(&RECT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@ -1725,7 +1725,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shBLURPREPARE.texAttrib);
if (!damage.empty()) {
for (auto& RECT : damage.getRects()) {
for (auto const& RECT : damage.getRects()) {
scissor(&RECT, false /* this region is already transformed */);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@ -1778,7 +1778,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o
glEnableVertexAttribArray(pShader->texAttrib);
if (!pDamage->empty()) {
for (auto& RECT : pDamage->getRects()) {
for (auto const& RECT : pDamage->getRects()) {
scissor(&RECT, false /* this region is already transformed */);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@ -1848,7 +1848,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o
glEnableVertexAttribArray(m_RenderData.pCurrentMonData->m_shBLURFINISH.texAttrib);
if (!damage.empty()) {
for (auto& RECT : damage.getRects()) {
for (auto const& RECT : damage.getRects()) {
scissor(&RECT, false /* this region is already transformed */);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@ -1924,7 +1924,7 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) {
};
bool hasWindows = false;
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_pWorkspace == pMonitor->activeWorkspace && !w->isHidden() && w->m_bIsMapped && (!w->m_bIsFloating || *PBLURXRAY)) {
// check if window is valid
@ -2215,13 +2215,13 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, in
damageClip.intersect(m_RenderData.damage);
if (!damageClip.empty()) {
for (auto& RECT : damageClip.getRects()) {
for (auto const& RECT : damageClip.getRects()) {
scissor(&RECT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}
} else {
for (auto& RECT : m_RenderData.damage.getRects()) {
for (auto const& RECT : m_RenderData.damage.getRects()) {
scissor(&RECT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@ -2512,13 +2512,13 @@ void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, int round, int range, const
damageClip.intersect(m_RenderData.damage);
if (!damageClip.empty()) {
for (auto& RECT : damageClip.getRects()) {
for (auto const& RECT : damageClip.getRects()) {
scissor(&RECT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
}
} else {
for (auto& RECT : m_RenderData.damage.getRects()) {
for (auto const& RECT : m_RenderData.damage.getRects()) {
scissor(&RECT);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@ -2928,7 +2928,7 @@ void SRenderModifData::applyToBox(CBox& box) {
if (!enabled)
return;
for (auto& [type, val] : modifs) {
for (auto const& [type, val] : modifs) {
try {
switch (type) {
case RMOD_TYPE_SCALE: box.scale(std::any_cast<float>(val)); break;
@ -2953,7 +2953,7 @@ void SRenderModifData::applyToRegion(CRegion& rg) {
if (!enabled)
return;
for (auto& [type, val] : modifs) {
for (auto const& [type, val] : modifs) {
try {
switch (type) {
case RMOD_TYPE_SCALE: rg.scale(std::any_cast<float>(val)); break;
@ -2971,7 +2971,7 @@ float SRenderModifData::combinedScale() {
return 1;
float scale = 1.f;
for (auto& [type, val] : modifs) {
for (auto const& [type, val] : modifs) {
try {
switch (type) {
case RMOD_TYPE_SCALE: scale *= std::any_cast<float>(val); break;

View File

@ -35,7 +35,7 @@ static int cursorTicker(void* data) {
CHyprRenderer::CHyprRenderer() {
if (g_pCompositor->m_pAqBackend->hasSession()) {
for (auto& dev : g_pCompositor->m_pAqBackend->session->sessionDevices) {
for (auto const& dev : g_pCompositor->m_pAqBackend->session->sessionDevices) {
const auto DRMV = drmGetVersion(dev->fd);
if (!DRMV)
continue;
@ -348,7 +348,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORK
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
// loop over the tiled windows that are fading out
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!shouldRenderWindow(w, pMonitor))
continue;
@ -365,7 +365,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORK
}
// and floating ones too
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!shouldRenderWindow(w, pMonitor))
continue;
@ -385,7 +385,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORK
}
// TODO: this pass sucks
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
const auto PWORKSPACE = w->m_pWorkspace;
if (w->m_pWorkspace != pWorkspace || !w->isFullscreen()) {
@ -418,7 +418,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORK
}
// then render windows over fullscreen.
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->m_pWorkspace != pWorkspaceWindow->m_pWorkspace || (!w->m_bCreatedOverFullscreen && !w->m_bPinned) || (!w->m_bIsMapped && !w->m_bFadingOut) || w->isFullscreen())
continue;
@ -438,7 +438,7 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, PHLWORKSPACE pWor
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
// Non-floating main
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut))
continue;
@ -465,7 +465,7 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, PHLWORKSPACE pWor
renderWindow(lastWindow, pMonitor, time, true, RENDER_PASS_MAIN);
// Non-floating popup
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut))
continue;
@ -483,7 +483,7 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, PHLWORKSPACE pWor
}
// floating on top
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut))
continue;
@ -585,20 +585,20 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, CMonitor* pMonitor, timespec
if (TRANSFORMERSPRESENT) {
g_pHyprOpenGL->bindOffMain();
for (auto& t : pWindow->m_vTransformers) {
for (auto const& t : pWindow->m_vTransformers) {
t->preWindowRender(&renderdata);
}
}
if (renderdata.decorate) {
for (auto& wd : pWindow->m_dWindowDecorations) {
for (auto const& wd : pWindow->m_dWindowDecorations) {
if (wd->getDecorationLayer() != DECORATION_LAYER_BOTTOM)
continue;
wd->draw(pMonitor, renderdata.alpha * renderdata.fadeAlpha);
}
for (auto& wd : pWindow->m_dWindowDecorations) {
for (auto const& wd : pWindow->m_dWindowDecorations) {
if (wd->getDecorationLayer() != DECORATION_LAYER_UNDER)
continue;
@ -625,7 +625,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, CMonitor* pMonitor, timespec
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = false;
if (renderdata.decorate) {
for (auto& wd : pWindow->m_dWindowDecorations) {
for (auto const& wd : pWindow->m_dWindowDecorations) {
if (wd->getDecorationLayer() != DECORATION_LAYER_OVER)
continue;
@ -636,7 +636,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, CMonitor* pMonitor, timespec
if (TRANSFORMERSPRESENT) {
CFramebuffer* last = g_pHyprOpenGL->m_RenderData.currentFB;
for (auto& t : pWindow->m_vTransformers) {
for (auto const& t : pWindow->m_vTransformers) {
last = t->transform(last);
}
@ -700,7 +700,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, CMonitor* pMonitor, timespec
}
if (decorate) {
for (auto& wd : pWindow->m_dWindowDecorations) {
for (auto const& wd : pWindow->m_dWindowDecorations) {
if (wd->getDecorationLayer() != DECORATION_LAYER_OVERLAY)
continue;
@ -852,16 +852,16 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, PHLWORKSPAC
}
g_pHyprOpenGL->blend(true);
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
renderLayer(ls.lock(), pMonitor, time);
}
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
renderLayer(ls.lock(), pMonitor, time);
}
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
renderLayer(ls.lock(), pMonitor, time);
}
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
renderLayer(ls.lock(), pMonitor, time);
}
@ -892,10 +892,10 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, PHLWORKSPAC
}
g_pHyprOpenGL->blend(true);
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
renderLayer(ls.lock(), pMonitor, time);
}
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]) {
renderLayer(ls.lock(), pMonitor, time);
}
@ -945,7 +945,7 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, PHLWORKSPAC
}
// pinned always above
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
continue;
@ -962,21 +962,21 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, PHLWORKSPAC
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOWS);
// Render surfaces above windows for monitor
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
renderLayer(ls.lock(), pMonitor, time);
}
// Render IME popups
for (auto& imep : g_pInputManager->m_sIMERelay.m_vIMEPopups) {
for (auto const& imep : g_pInputManager->m_sIMERelay.m_vIMEPopups) {
renderIMEPopup(imep.get(), pMonitor, time);
}
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
renderLayer(ls.lock(), pMonitor, time);
}
for (auto& lsl : pMonitor->m_aLayerSurfaceLayers) {
for (auto& ls : lsl) {
for (auto const& lsl : pMonitor->m_aLayerSurfaceLayers) {
for (auto const& ls : lsl) {
renderLayer(ls.lock(), pMonitor, time, true);
}
}
@ -1456,7 +1456,7 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(CMonitor* pMonitor) {
if (!sync)
Debug::log(TRACE, "Explicit: can't add sync, EGLSync failed");
else {
for (auto& e : explicitPresented) {
for (auto const& e : explicitPresented) {
if (!e->current.buffer || !e->current.buffer->releaser)
continue;
@ -1579,7 +1579,7 @@ static void applyExclusive(CBox& usableArea, uint32_t anchor, int32_t exclusive,
void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<PHLLSREF>& layerSurfaces, bool exclusiveZone, CBox* usableArea) {
CBox full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y};
for (auto& ls : layerSurfaces) {
for (auto const& ls : layerSurfaces) {
if (!ls || ls->fadingOut || ls->readyToDelete || !ls->layerSurface || ls->noProcess)
continue;
@ -1725,7 +1725,7 @@ void CHyprRenderer::damageSurface(SP<CWLSurfaceResource> pSurface, double x, dou
CRegion damageBoxForEach;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (!m->output)
continue;
@ -1752,7 +1752,7 @@ void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) {
windowBox.translate(PWINDOWWORKSPACE->m_vRenderOffset.value());
windowBox.translate(pWindow->m_vFloatingOffset);
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (forceFull || g_pHyprRenderer->shouldRenderWindow(pWindow, m.get())) { // only damage if window is rendered on monitor
CBox fixedDamageBox = {windowBox.x - m->vecPosition.x, windowBox.y - m->vecPosition.y, windowBox.width, windowBox.height};
fixedDamageBox.scale(m->scale);
@ -1760,7 +1760,7 @@ void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) {
}
}
for (auto& wd : pWindow->m_dWindowDecorations)
for (auto const& wd : pWindow->m_dWindowDecorations)
wd->damageEntire();
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
@ -1786,7 +1786,7 @@ void CHyprRenderer::damageBox(CBox* pBox, bool skipFrameSchedule) {
if (g_pCompositor->m_bUnsafeState)
return;
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (m->isMirror())
continue; // don't damage mirrors traditionally
@ -1814,7 +1814,7 @@ void CHyprRenderer::damageRegion(const CRegion& rg) {
}
void CHyprRenderer::damageMirrorsWith(CMonitor* pMonitor, const CRegion& pRegion) {
for (auto& mirror : pMonitor->mirrors) {
for (auto const& mirror : pMonitor->mirrors) {
// transform the damage here, so it won't get clipped by the monitor damage ring
auto monitor = mirror;
@ -1932,7 +1932,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
if (!pMonitor->output->modes.empty() && RULE->drmMode.type != DRM_MODE_TYPE_USERDEF) {
bool found = false;
for (auto& mode : pMonitor->output->modes) {
for (auto const& mode : pMonitor->output->modes) {
// if delta of refresh rate, w and h chosen and mode is < 1 we accept it
if (DELTALESSTHAN(mode->pixelSize.x, RULE->resolution.x, 1) && DELTALESSTHAN(mode->pixelSize.y, RULE->resolution.y, 1) &&
DELTALESSTHAN(mode->refreshRate / 1000.f, RULE->refreshRate, 1)) {
@ -2035,7 +2035,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
//(-1,-1) indicates a preference to refreshrate over resolution, (-1,-2) preference to resolution
if (RULE->resolution == Vector2D(-1, -1)) {
for (auto& mode : pMonitor->output->modes) {
for (auto const& mode : pMonitor->output->modes) {
if ((mode->pixelSize.x >= currentWidth && mode->pixelSize.y >= currentHeight && mode->refreshRate >= (currentRefresh - 1000.f)) ||
mode->refreshRate > (currentRefresh + 3000.f)) {
pMonitor->output->state->setMode(mode);
@ -2048,7 +2048,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
}
}
} else {
for (auto& mode : pMonitor->output->modes) {
for (auto const& mode : pMonitor->output->modes) {
if ((mode->pixelSize.x >= currentWidth && mode->pixelSize.y >= currentHeight && mode->refreshRate >= (currentRefresh - 1000.f)) ||
(mode->pixelSize.x > currentWidth && mode->pixelSize.y > currentHeight)) {
pMonitor->output->state->setMode(mode);
@ -2099,7 +2099,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
Debug::log(ERR, "Monitor {} has NO PREFERRED MODE", pMonitor->output->name);
if (!pMonitor->output->modes.empty()) {
for (auto& mode : pMonitor->output->modes) {
for (auto const& mode : pMonitor->output->modes) {
pMonitor->output->state->setMode(mode);
if (!pMonitor->state.test()) {
@ -2148,7 +2148,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
bool set10bit = false;
for (auto& fmt : formats[(int)!RULE->enable10bit]) {
for (auto const& fmt : formats[(int)!RULE->enable10bit]) {
pMonitor->output->state->setFormat(fmt.second);
pMonitor->drmFormat = fmt.second;
@ -2245,7 +2245,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
// Set scale for all surfaces on this monitor, needed for some clients
// but not on unsafe state to avoid crashes
if (!g_pCompositor->m_bUnsafeState) {
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
w->updateSurfaceScaleTransformDetails();
}
}
@ -2317,7 +2317,7 @@ void CHyprRenderer::ensureCursorRenderingMode() {
if (HIDE) {
Debug::log(LOG, "Hiding the cursor (hl-mandated)");
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (!g_pPointerManager->softwareLockedFor(m))
continue;
@ -2329,7 +2329,7 @@ void CHyprRenderer::ensureCursorRenderingMode() {
} else {
Debug::log(LOG, "Showing the cursor (hl-mandated)");
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (!g_pPointerManager->softwareLockedFor(m))
continue;
@ -2421,7 +2421,7 @@ void CHyprRenderer::setOccludedForMainWorkspace(CRegion& region, PHLWORKSPACE pW
if (!PMONITOR->activeSpecialWorkspace)
return;
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PMONITOR->activeSpecialWorkspace)
continue;
@ -2452,7 +2452,7 @@ void CHyprRenderer::setOccludedForBackLayers(CRegion& region, PHLWORKSPACE pWork
static auto PBLURPASSES = CConfigValue<Hyprlang::INT>("decoration:blur:passes");
const auto BLURRADIUS = *PBLUR ? (*PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, *PBLURPASSES)) : 0;
for (auto& w : g_pCompositor->m_vWindows) {
for (auto const& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != pWorkspace)
continue;
@ -2476,7 +2476,7 @@ void CHyprRenderer::setOccludedForBackLayers(CRegion& region, PHLWORKSPACE pWork
}
bool CHyprRenderer::canSkipBackBufferClear(CMonitor* pMonitor) {
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
for (auto const& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]) {
if (!ls->layerSurface)
continue;

View File

@ -120,7 +120,7 @@ void CTexture::update(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, cons
}
#endif
for (auto& rect : rects) {
for (auto const& rect : rects) {
GLCALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, stride / format->bytesPerBlock));
GLCALL(glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, rect.x1));
GLCALL(glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, rect.y1));

View File

@ -118,7 +118,7 @@ void CHyprBorderDecoration::damageEntire() {
CRegion borderRegion(surfaceBoxExpandedBorder);
borderRegion.subtract(surfaceBoxShrunkRounding);
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (!g_pHyprRenderer->shouldRenderWindow(m_pWindow.lock(), m.get())) {
const CRegion monitorRegion({m->vecPosition, m->vecSize});
borderRegion.subtract(monitorRegion);

View File

@ -66,7 +66,7 @@ void CHyprDropShadowDecoration::damageEntire() {
shadowRegion.subtract(CRegion(surfaceBox));
}
for (auto& m : g_pCompositor->m_vMonitors) {
for (auto const& m : g_pCompositor->m_vMonitors) {
if (!g_pHyprRenderer->shouldRenderWindow(PWINDOW, m.get())) {
const CRegion monitorRegion({m->vecPosition, m->vecSize});
shadowRegion.subtract(monitorRegion);

View File

@ -192,7 +192,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
}
CTitleTex* CHyprGroupBarDecoration::textureFromTitle(const std::string& title) {
for (auto& tex : m_sTitleTexs.titleTexs) {
for (auto const& tex : m_sTitleTexs.titleTexs) {
if (tex->szContent == title)
return tex.get();
}

View File

@ -125,7 +125,7 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
//
std::vector<CDecorationPositioner::SWindowPositioningData*> datas;
for (auto& wd : pWindow->m_dWindowDecorations) {
for (auto const& wd : pWindow->m_dWindowDecorations) {
datas.push_back(getDataFor(wd.get(), pWindow));
}
@ -296,7 +296,7 @@ SBoxExtents CDecorationPositioner::getWindowDecorationReserved(PHLWINDOW pWindow
SBoxExtents CDecorationPositioner::getWindowDecorationExtents(PHLWINDOW pWindow, bool inputOnly) {
CBox accum = pWindow->getWindowMainSurfaceBox();
for (auto& data : m_vWindowPositioningDatas) {
for (auto const& data : m_vWindowPositioningDatas) {
if (data->pWindow.lock() != pWindow)
continue;
@ -337,7 +337,7 @@ SBoxExtents CDecorationPositioner::getWindowDecorationExtents(PHLWINDOW pWindow,
CBox CDecorationPositioner::getBoxWithIncludedDecos(PHLWINDOW pWindow) {
CBox accum = pWindow->getWindowMainSurfaceBox();
for (auto& data : m_vWindowPositioningDatas) {
for (auto const& data : m_vWindowPositioningDatas) {
if (data->pWindow.lock() != pWindow)
continue;

View File

@ -417,7 +417,7 @@ void CXWM::focusWindow(SP<CXWaylandSurface> surf) {
// send state to all toplevel surfaces, sometimes we might lose some
// that could still stick with the focused atom
for (auto& s : mappedSurfaces) {
for (auto const& s : mappedSurfaces) {
if (!s || s->overrideRedirect)
continue;
@ -1025,7 +1025,7 @@ void CXWM::updateClientList() {
std::erase_if(mappedSurfacesStacking, [](const auto& e) { return e.expired() || !e->mapped; });
std::vector<xcb_window_t> windows;
for (auto& m : mappedSurfaces) {
for (auto const& m : mappedSurfaces) {
windows.push_back(m->xID);
}
@ -1033,7 +1033,7 @@ void CXWM::updateClientList() {
windows.clear();
for (auto& m : mappedSurfacesStacking) {
for (auto const& m : mappedSurfacesStacking) {
windows.push_back(m->xID);
}