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

View file

@ -49,7 +49,7 @@ void DataState::addNewPluginRepo(const SPluginRepository& repo) {
{"rev", repo.rev} {"rev", repo.rev}
}} }}
}; };
for (auto& p : repo.plugins) { for (auto const& p : repo.plugins) {
// copy .so to the good place // copy .so to the good place
if (std::filesystem::exists(p.filename)) if (std::filesystem::exists(p.filename))
std::filesystem::copy_file(p.filename, PATH + "/" + p.name + ".so"); 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); auto manifest = toml::parse_file(path);
if (type == MANIFEST_HYPRLOAD) { if (type == MANIFEST_HYPRLOAD) {
for (auto& [key, val] : manifest) { for (auto const& [key, val] : manifest) {
if (key.str().ends_with(".build")) if (key.str().ends_with(".build"))
continue; 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") if (key.str() == "repository")
continue; continue;

View file

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

View file

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

View file

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

View file

@ -57,7 +57,7 @@ static std::string formatToString(uint32_t drmFormat) {
static std::string availableModesForOutput(CMonitor* pMonitor, eHyprCtlOutputFormat format) { static std::string availableModesForOutput(CMonitor* pMonitor, eHyprCtlOutputFormat format) {
std::string result; std::string result;
for (auto& m : pMonitor->output->modes) { for (auto const& m : pMonitor->output->modes) {
if (format == FORMAT_NORMAL) if (format == FORMAT_NORMAL)
result += std::format("{}x{}@{:.2f}Hz ", m->pixelSize.x, m->pixelSize.y, m->refreshRate / 1000.0); result += std::format("{}x{}@{:.2f}Hz ", m->pixelSize.x, m->pixelSize.y, m->refreshRate / 1000.0);
else else
@ -445,13 +445,13 @@ std::string layersRequest(eHyprCtlOutputFormat format, std::string request) {
escapeJSONStrings(mon->szName)); escapeJSONStrings(mon->szName));
int layerLevel = 0; int layerLevel = 0;
for (auto& level : mon->m_aLayerSurfaceLayers) { for (auto const& level : mon->m_aLayerSurfaceLayers) {
result += std::format( result += std::format(
R"#( R"#(
"{}": [ "{}": [
)#", )#",
layerLevel); layerLevel);
for (auto& layer : level) { for (auto const& layer : level) {
result += std::format( result += std::format(
R"#( {{ R"#( {{
"address": "0x{:x}", "address": "0x{:x}",
@ -484,14 +484,14 @@ std::string layersRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\n}\n"; result += "\n}\n";
} else { } else {
for (auto& mon : g_pCompositor->m_vMonitors) { for (auto const& mon : g_pCompositor->m_vMonitors) {
result += std::format("Monitor {}:\n", mon->szName); result += std::format("Monitor {}:\n", mon->szName);
int layerLevel = 0; int layerLevel = 0;
static const std::array<std::string, 4> levelNames = {"background", "bottom", "top", "overlay"}; 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]); 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, 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); layer->geometry.height, layer->szNamespace);
} }
@ -510,7 +510,7 @@ std::string layoutsRequest(eHyprCtlOutputFormat format, std::string request) {
if (format == eHyprCtlOutputFormat::FORMAT_JSON) { if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
result += "["; result += "[";
for (auto& m : g_pLayoutManager->getAllLayoutNames()) { for (auto const& m : g_pLayoutManager->getAllLayoutNames()) {
result += std::format( result += std::format(
R"#( R"#(
"{}",)#", "{}",)#",
@ -520,7 +520,7 @@ std::string layoutsRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\n]\n"; result += "\n]\n";
} else { } else {
for (auto& m : g_pLayoutManager->getAllLayoutNames()) { for (auto const& m : g_pLayoutManager->getAllLayoutNames()) {
result += std::format("{}\n", m); result += std::format("{}\n", m);
} }
} }
@ -557,7 +557,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "{\n"; result += "{\n";
result += "\"mice\": [\n"; result += "\"mice\": [\n";
for (auto& m : g_pInputManager->m_vPointers) { for (auto const& m : g_pInputManager->m_vPointers) {
result += std::format( result += std::format(
R"#( {{ R"#( {{
"address": "0x{:x}", "address": "0x{:x}",
@ -572,7 +572,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\n],\n"; result += "\n],\n";
result += "\"keyboards\": [\n"; result += "\"keyboards\": [\n";
for (auto& k : g_pInputManager->m_vKeyboards) { for (auto const& k : g_pInputManager->m_vKeyboards) {
const auto KM = k->getActiveLayout(); const auto KM = k->getActiveLayout();
result += std::format( result += std::format(
R"#( {{ R"#( {{
@ -596,7 +596,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\"tablets\": [\n"; result += "\"tablets\": [\n";
for (auto& d : g_pInputManager->m_vTabletPads) { for (auto const& d : g_pInputManager->m_vTabletPads) {
result += std::format( result += std::format(
R"#( {{ R"#( {{
"address": "0x{:x}", "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 : "")); (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( result += std::format(
R"#( {{ R"#( {{
"address": "0x{:x}", "address": "0x{:x}",
@ -618,7 +618,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
(uintptr_t)d.get(), escapeJSONStrings(d->hlName)); (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( result += std::format(
R"#( {{ R"#( {{
"address": "0x{:x}", "address": "0x{:x}",
@ -632,7 +632,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\"touch\": [\n"; result += "\"touch\": [\n";
for (auto& d : g_pInputManager->m_vTouches) { for (auto const& d : g_pInputManager->m_vTouches) {
result += std::format( result += std::format(
R"#( {{ R"#( {{
"address": "0x{:x}", "address": "0x{:x}",
@ -646,7 +646,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
result += "\"switches\": [\n"; result += "\"switches\": [\n";
for (auto& d : g_pInputManager->m_lSwitches) { for (auto const& d : g_pInputManager->m_lSwitches) {
result += std::format( result += std::format(
R"#( {{ R"#( {{
"address": "0x{:x}", "address": "0x{:x}",
@ -663,14 +663,14 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
} else { } else {
result += "mice:\n"; 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, 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)); (m->aq() && m->aq()->getLibinputHandle() ? libinput_device_config_accel_get_default_speed(m->aq()->getLibinputHandle()) : 0.f));
} }
result += "\n\nKeyboards:\n"; result += "\n\nKeyboards:\n";
for (auto& k : g_pInputManager->m_vKeyboards) { for (auto const& k : g_pInputManager->m_vKeyboards) {
const auto KM = k->getActiveLayout(); 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", 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, (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"; 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 : ""); 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); 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 += std::format("\tTablet Tool at {:x}\n", (uintptr_t)d.get());
} }
result += "\n\nTouch:\n"; 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 += std::format("\tTouch Device at {:x}:\n\t\t{}\n", (uintptr_t)d.get(), d->hlName);
} }
result += "\n\nSwitches:\n"; 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() : ""); 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) { if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
ret += "animations:\n"; 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, 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); ac.second.internalBezier, ac.second.internalEnabled, ac.second.internalSpeed, ac.second.internalStyle);
} }
ret += "beziers:\n"; ret += "beziers:\n";
for (auto& bz : g_pAnimationManager->getAllBeziers()) { for (auto const& bz : g_pAnimationManager->getAllBeziers()) {
ret += std::format("\n\tname: {}\n", bz.first); ret += std::format("\n\tname: {}\n", bz.first);
} }
} else { } else {
// json // json
ret += "[["; ret += "[[";
for (auto& ac : g_pConfigManager->getAnimationConfig()) { for (auto const& ac : g_pConfigManager->getAnimationConfig()) {
ret += std::format(R"#( ret += std::format(R"#(
{{ {{
"name": "{}", "name": "{}",
@ -778,7 +778,7 @@ std::string globalShortcutsRequest(eHyprCtlOutputFormat format, std::string requ
std::string ret = ""; std::string ret = "";
const auto SHORTCUTS = PROTO::globalShortcuts->getAllShortcuts(); const auto SHORTCUTS = PROTO::globalShortcuts->getAllShortcuts();
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) { if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
for (auto& sh : SHORTCUTS) for (auto const& sh : SHORTCUTS)
ret += std::format("{}:{} -> {}\n", sh.appid, sh.id, sh.description); ret += std::format("{}:{} -> {}\n", sh.appid, sh.id, sh.description);
} else { } else {
ret += "["; ret += "[";
@ -800,7 +800,7 @@ std::string globalShortcutsRequest(eHyprCtlOutputFormat format, std::string requ
std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) { std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
std::string ret = ""; std::string ret = "";
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) { if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
for (auto& kb : g_pKeybindManager->m_lKeybinds) { for (auto const& kb : g_pKeybindManager->m_lKeybinds) {
ret += "bind"; ret += "bind";
if (kb.locked) if (kb.locked)
ret += "l"; ret += "l";
@ -821,7 +821,7 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
} else { } else {
// json // json
ret += "["; ret += "[";
for (auto& kb : g_pKeybindManager->m_lKeybinds) { for (auto const& kb : g_pKeybindManager->m_lKeybinds) {
ret += std::format( ret += std::format(
R"#( R"#(
{{ {{
@ -935,7 +935,7 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
result += "os-release: " + execAndGet("cat /etc/os-release") + "\n\n"; result += "os-release: " + execAndGet("cat /etc/os-release") + "\n\n";
result += "plugins:\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); 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 // decorations will probably need a repaint
if (COMMAND.contains("decoration:") || COMMAND.contains("border") || COMMAND == "workspace" || COMMAND.contains("zoom_factor") || COMMAND == "source") { 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_pHyprRenderer->damageMonitor(m.get());
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
} }
@ -1359,7 +1359,7 @@ std::string decorationRequest(eHyprCtlOutputFormat format, std::string request)
std::string result = ""; std::string result = "";
if (format == eHyprCtlOutputFormat::FORMAT_JSON) { if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
result += "["; 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},"; 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 += "]"; result += "]";
} else { } else {
result = +"Decoration\tPriority\n"; 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"; 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])) if (g_pCompositor->getMonitorFromName(vars[3]))
return "A real monitor already uses that name."; 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(); auto type = impl->type();
if (type == Aquamarine::AQ_BACKEND_HEADLESS && (vars[2] == "headless" || vars[2] == "auto")) { 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"; return "no plugins loaded";
std::string list = ""; 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); 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 = ""; std::string result = "";
// parse exact cmds first, then non-exact. // parse exact cmds first, then non-exact.
for (auto& cmd : m_vCommands) { for (auto const& cmd : m_vCommands) {
if (!cmd->exact) if (!cmd->exact)
continue; continue;
@ -1684,7 +1684,7 @@ std::string CHyprCtl::getReply(std::string request) {
} }
if (result.empty()) if (result.empty())
for (auto& cmd : m_vCommands) { for (auto const& cmd : m_vCommands) {
if (cmd->exact) if (cmd->exact)
continue; continue;
@ -1715,7 +1715,7 @@ std::string CHyprCtl::getReply(std::string request) {
rd.blurFBDirty = true; rd.blurFBDirty = true;
} }
for (auto& m : g_pCompositor->m_vMonitors) { for (auto const& m : g_pCompositor->m_vMonitors) {
g_pHyprRenderer->damageMonitor(m.get()); g_pHyprRenderer->damageMonitor(m.get());
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
} }

View file

@ -217,7 +217,7 @@ void CHyprDebugOverlay::draw() {
// draw the things // draw the things
int offsetY = 0; 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 += m_mMonitorOverlays[m.get()].draw(offsetY);
offsetY += 5; // for padding between mons 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->icon = icon;
PNOTIF->fontSize = fontSize; PNOTIF->fontSize = fontSize;
for (auto& m : g_pCompositor->m_vMonitors) { for (auto const& m : g_pCompositor->m_vMonitors) {
g_pCompositor->scheduleFrameForMonitor(m.get()); g_pCompositor->scheduleFrameForMonitor(m.get());
} }
} }
@ -87,7 +87,7 @@ CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
const auto iconBackendID = iconBackendFromLayout(layout); const auto iconBackendID = iconBackendFromLayout(layout);
const auto PBEZIER = g_pAnimationManager->getBezier("default"); 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 ICONPADFORNOTIF = notif->icon == ICON_NONE ? 0 : ICON_PAD;
const auto FONTSIZE = std::clamp((int)(notif->fontSize * ((pMonitor->vecPixelSize.x * SCALE) / 1920.f)), 8, 40); 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; xray = -1;
animationStyle.reset(); animationStyle.reset();
for (auto& rule : g_pConfigManager->getMatchingRules(self.lock())) { for (auto const& rule : g_pConfigManager->getMatchingRules(self.lock())) {
if (rule.rule == "noanim") if (rule.rule == "noanim")
noAnimations = true; noAnimations = true;
else if (rule.rule == "blur") else if (rule.rule == "blur")

View file

@ -251,7 +251,7 @@ void CPopup::recheckTree() {
void CPopup::recheckChildrenRecursive() { void CPopup::recheckChildrenRecursive() {
auto cpy = m_vChildren; auto cpy = m_vChildren;
for (auto& c : cpy) { for (auto const& c : cpy) {
c->onCommit(true); c->onCommit(true);
c->recheckChildrenRecursive(); c->recheckChildrenRecursive();
} }
@ -282,14 +282,14 @@ bool CPopup::visible() {
} }
void CPopup::bfHelper(std::vector<CPopup*> nodes, std::function<void(CPopup*, void*)> fn, void* data) { 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); fn(n, data);
} }
std::vector<CPopup*> nodes2; std::vector<CPopup*> nodes2;
for (auto& n : nodes) { for (auto const& n : nodes) {
for (auto& c : n->m_vChildren) { for (auto const& c : n->m_vChildren) {
nodes2.push_back(c.get()); nodes2.push_back(c.get());
} }
} }
@ -308,7 +308,7 @@ CPopup* CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
std::vector<CPopup*> popups; std::vector<CPopup*> popups;
breadthfirst([](CPopup* popup, void* data) { ((std::vector<CPopup*>*)data)->push_back(popup); }, &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) if (!p->m_pResource)
continue; 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; 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) if (n.get() == this)
continue; continue;
@ -75,7 +75,7 @@ void CSubsurface::checkSiblingDamage() {
} }
void CSubsurface::recheckDamageForSubsurfaces() { void CSubsurface::recheckDamageForSubsurfaces() {
for (auto& n : m_vChildren) { for (auto const& n : m_vChildren) {
const auto COORDS = n->coordsGlobal(); const auto COORDS = n->coordsGlobal();
g_pHyprRenderer->damageSurface(n->m_pWLSurface->resource(), COORDS.x, COORDS.y); g_pHyprRenderer->damageSurface(n->m_pWLSurface->resource(), COORDS.x, COORDS.y);
} }
@ -183,7 +183,7 @@ Vector2D CSubsurface::coordsGlobal() {
} }
void CSubsurface::initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface) { void CSubsurface::initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface) {
for (auto& s : pSurface->subsurfaces) { for (auto const& s : pSurface->subsurfaces) {
if (!s || s->surface->hlSurface /* already assigned */) if (!s || s->surface->hlSurface /* already assigned */)
continue; continue;
onNewSubsurface(s.lock()); onNewSubsurface(s.lock());

View file

@ -296,7 +296,7 @@ void CWindow::removeWindowDeco(IHyprWindowDecoration* deco) {
} }
void CWindow::uncacheWindowDecos() { void CWindow::uncacheWindowDecos() {
for (auto& wd : m_dWindowDecorations) { for (auto const& wd : m_dWindowDecorations) {
g_pDecorationPositioner->uncacheDecoration(wd.get()); 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)) if (type != INPUT_TYPE_DRAG_END && hasPopupAt(mouseCoords))
return false; return false;
for (auto& wd : m_dWindowDecorations) { for (auto const& wd : m_dWindowDecorations) {
if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT)) if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
continue; continue;
@ -337,7 +337,7 @@ pid_t CWindow::getPID() {
} }
IHyprWindowDecoration* CWindow::getDecorationByType(eDecorationType type) { IHyprWindowDecoration* CWindow::getDecorationByType(eDecorationType type) {
for (auto& wd : m_dWindowDecorations) { for (auto const& wd : m_dWindowDecorations) {
if (wd->getDecorationType() == type) if (wd->getDecorationType() == type)
return wd.get(); return wd.get();
} }
@ -666,7 +666,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
return; return;
} }
for (auto& token : colorsAndAngles) { for (auto const& token : colorsAndAngles) {
// The first angle, or an explicit "0deg", splits the two gradients // The first angle, or an explicit "0deg", splits the two gradients
if (active && token.contains("deg")) { if (active && token.contains("deg")) {
activeBorderGradient.m_fAngle = std::stoi(token.substr(0, token.size() - 3)) * (PI / 180.0); 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; const bool GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked;
g_pKeybindManager->m_bGroupsLocked = true; g_pKeybindManager->m_bGroupsLocked = true;
for (auto& w : members) { for (auto const& w : members) {
g_pLayoutManager->getCurrentLayout()->onWindowCreated(w); g_pLayoutManager->getCurrentLayout()->onWindowCreated(w);
w->updateWindowDecos(); 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); CVarList envs(std::string{buffer.data(), buffer.size() - 1}, 0, '\n', true);
for (auto& e : envs) { for (auto const& e : envs) {
if (!e.contains('=')) if (!e.contains('='))
continue; continue;
@ -1511,7 +1511,7 @@ PHLWINDOW CWindow::getSwallower() {
if (!currentPid) if (!currentPid)
break; break;
for (auto& w : g_pCompositor->m_vWindows) { for (auto const& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped || w->isHidden()) if (!w->m_bIsMapped || w->isHidden())
continue; continue;
@ -1536,7 +1536,7 @@ PHLWINDOW CWindow::getSwallower() {
return candidates.at(0); return candidates.at(0);
// walk up the focus history and find the last focused // 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) if (!w)
continue; continue;

View file

@ -94,7 +94,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
// set floating windows offset callbacks // set floating windows offset callbacks
m_vRenderOffset.setUpdateCallback([&](void*) { 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) if (!validMapped(w) || w->workspaceID() != m_iID)
continue; continue;
@ -386,7 +386,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
bool wantsCountVisible = false; bool wantsCountVisible = false;
int flagCount = 0; int flagCount = 0;
for (auto& flag : prop) { for (auto const& flag : prop) {
if (flag == 't' && wantsOnlyTiled == -1) { if (flag == 't' && wantsOnlyTiled == -1) {
wantsOnlyTiled = 1; wantsOnlyTiled = 1;
flagCount++; 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)) if (PWINDOW->m_bWantsInitialFullscreen || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->fullscreen))
requestedClientFSMode = FSMODE_FULLSCREEN; requestedClientFSMode = FSMODE_FULLSCREEN;
for (auto& r : PWINDOW->m_vMatchedRules) { for (auto const& r : PWINDOW->m_vMatchedRules) {
if (r.szRule.starts_with("monitor")) { if (r.szRule.starts_with("monitor")) {
try { try {
const auto MONITORSTR = trim(r.szRule.substr(r.szRule.find(' '))); 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; PWINDOW->m_bCreatedOverFullscreen = true;
// size and move rules // size and move rules
for (auto& r : PWINDOW->m_vMatchedRules) { for (auto const& r : PWINDOW->m_vMatchedRules) {
if (r.szRule.starts_with("size")) { if (r.szRule.starts_with("size")) {
try { try {
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1); 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)); m_dPoints.emplace_back(Vector2D(0, 0));
for (auto& p : *pVec) { for (auto const& p : *pVec) {
m_dPoints.push_back(p); m_dPoints.push_back(p);
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -591,7 +591,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
if (pWindow->m_bIsFloating) { if (pWindow->m_bIsFloating) {
// find whether there is a floating window below this one // 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 && 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) { !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, 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; return PWINDOWCANDIDATE;
// if not, floating window // 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 && 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) !w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow)
return w; 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 IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // get all rules, see if we have any size overrides.
Vector2D sizeOverride = {}; Vector2D sizeOverride = {};
if (g_pCompositor->m_pLastMonitor) { 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")) { if (r.szRule.starts_with("size")) {
try { try {
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1); 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) { } else if (WINDOWSONWORKSPACE == 2) {
// when dropping as the second tiled window in the workspace, // 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 // 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) { if (nd.isMaster && nd.workspaceID == PNODE->workspaceID) {
switch (orientation) { switch (orientation) {
case ORIENTATION_LEFT: case ORIENTATION_LEFT:
@ -619,7 +619,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
CMonitor* PMONITOR = nullptr; CMonitor* PMONITOR = nullptr;
if (g_pCompositor->isWorkspaceSpecial(pNode->workspaceID)) { 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) { if (m->activeSpecialWorkspaceID() == pNode->workspaceID) {
PMONITOR = m.get(); PMONITOR = m.get();
break; break;
@ -1106,7 +1106,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
const auto NEWFOCUS = newFocusToChild ? NEWCHILD : NEWMASTER; const auto NEWFOCUS = newFocusToChild ? NEWCHILD : NEWMASTER;
switchToWindow(NEWFOCUS); switchToWindow(NEWFOCUS);
} else { } else {
for (auto& n : m_lMasterNodesData) { for (auto const& n : m_lMasterNodesData) {
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) { if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
const auto NEWMASTER = n.pWindow.lock(); const auto NEWMASTER = n.pWindow.lock();
switchWindows(NEWMASTER, NEWCHILD); switchWindows(NEWMASTER, NEWCHILD);
@ -1141,7 +1141,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
return 0; return 0;
} else { } else {
// if master is focused keep master focused (don't do anything) // 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) { if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
switchToWindow(n.pWindow.lock()); switchToWindow(n.pWindow.lock());
break; break;
@ -1469,7 +1469,7 @@ Vector2D CHyprMasterLayout::predictSizeForNewWindowTiled() {
} }
void CHyprMasterLayout::onEnable() { 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()) if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
continue; continue;

View file

@ -70,7 +70,7 @@ void CAnimationManager::tick() {
std::vector<CBaseAnimatedVariable*> animationEndedVars; std::vector<CBaseAnimatedVariable*> animationEndedVars;
for (auto& av : m_vActiveAnimatedVariables) { for (auto const& av : m_vActiveAnimatedVariables) {
if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !*PSHADOWSENABLED) { if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !*PSHADOWSENABLED) {
av->warp(false); av->warp(false);
@ -113,7 +113,7 @@ void CAnimationManager::tick() {
g_pHyprRenderer->damageMonitor(PMONITOR); g_pHyprRenderer->damageMonitor(PMONITOR);
// TODO: just make this into a damn callback already vax... // 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) if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PWORKSPACE)
continue; continue;
@ -214,7 +214,7 @@ void CAnimationManager::tick() {
PWINDOW->updateWindowDecos(); PWINDOW->updateWindowDecos();
g_pHyprRenderer->damageWindow(PWINDOW); g_pHyprRenderer->damageWindow(PWINDOW);
} else if (PWORKSPACE) { } 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) if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE)
continue; 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. // 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(); ave->onAnimationEnd();
} }
} }
@ -293,7 +293,7 @@ bool CAnimationManager::deltazero(const CColor& a, const CColor& b) {
} }
bool CAnimationManager::bezierExists(const std::string& bezier) { bool CAnimationManager::bezierExists(const std::string& bezier) {
for (auto& [bc, bz] : m_mBezierCurves) { for (auto const& [bc, bz] : m_mBezierCurves) {
if (bc == bezier) if (bc == bezier)
return true; return true;
} }

View file

@ -193,7 +193,7 @@ void CCursorManager::setCursorFromName(const std::string& name) {
// fallback to a default if available // fallback to a default if available
constexpr const std::array<const char*, 3> fallbackShapes = {"default", "left_ptr", "left-ptr"}; 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); m_sCurrentCursorShapeData = m_pHyprcursor->getShape(s, m_sCurrentStyleInfo);
if (m_sCurrentCursorShapeData.images.size() > 0) if (m_sCurrentCursorShapeData.images.size() > 0)
@ -288,7 +288,7 @@ void CCursorManager::updateTheme() {
static auto PUSEHYPRCURSOR = CConfigValue<Hyprlang::INT>("cursor:enable_hyprcursor"); static auto PUSEHYPRCURSOR = CConfigValue<Hyprlang::INT>("cursor:enable_hyprcursor");
float highestScale = 1.0; float highestScale = 1.0;
for (auto& m : g_pCompositor->m_vMonitors) { for (auto const& m : g_pCompositor->m_vMonitors) {
if (m->scale > highestScale) if (m->scale > highestScale)
highestScale = m->scale; highestScale = m->scale;
} }
@ -307,7 +307,7 @@ void CCursorManager::updateTheme() {
setCursorFromName("left_ptr"); setCursorFromName("left_ptr");
for (auto& m : g_pCompositor->m_vMonitors) { for (auto const& m : g_pCompositor->m_vMonitors) {
m->forceFullFrames = 5; m->forceFullFrames = 5;
g_pCompositor->scheduleFrameForMonitor(m.get(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE); 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; std::vector<HANDLE> faultyHandles;
volatile bool needsDeadCleanup = false; volatile bool needsDeadCleanup = false;
for (auto& cb : *callbacks) { for (auto const& cb : *callbacks) {
m_bCurrentEventPlugin = false; 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(); }); std::erase_if(*callbacks, [](const auto& fn) { return !fn.fn.lock(); });
if (!faultyHandles.empty()) { if (!faultyHandles.empty()) {
for (auto& h : faultyHandles) for (auto const& h : faultyHandles)
g_pPluginSystem->unloadPlugin(g_pPluginSystem->getPluginByHandle(h), true); g_pPluginSystem->unloadPlugin(g_pPluginSystem->getPluginByHandle(h), true);
} }
} }

View file

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

View file

@ -76,14 +76,14 @@ void CPointerManager::checkDefaultCursorWarp(SP<CMonitor> monitor, std::string m
} }
void CPointerManager::lockSoftwareAll() { void CPointerManager::lockSoftwareAll() {
for (auto& state : monitorStates) for (auto const& state : monitorStates)
state->softwareLocks++; state->softwareLocks++;
updateCursorBackend(); updateCursorBackend();
} }
void CPointerManager::unlockSoftwareAll() { void CPointerManager::unlockSoftwareAll() {
for (auto& state : monitorStates) for (auto const& state : monitorStates)
state->softwareLocks--; state->softwareLocks--;
updateCursorBackend(); updateCursorBackend();
@ -261,7 +261,7 @@ void CPointerManager::resetCursorImage(bool apply) {
damageIfSoftware(); damageIfSoftware();
if (currentCursorImage.surface) { if (currentCursorImage.surface) {
for (auto& m : g_pCompositor->m_vMonitors) { for (auto const& m : g_pCompositor->m_vMonitors) {
currentCursorImage.surface->resource()->leave(m); currentCursorImage.surface->resource()->leave(m);
} }
@ -306,7 +306,7 @@ void CPointerManager::resetCursorImage(bool apply) {
void CPointerManager::updateCursorBackend() { void CPointerManager::updateCursorBackend() {
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors"); 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); auto state = stateFor(m);
if (!m->m_bEnabled || !m->dpmsStatus) { 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 { static auto INSIDE_LAYOUT = [this](const CBox& box) -> bool {
for (auto& b : currentMonitorLayout.monitorBoxes) { for (auto const& b : currentMonitorLayout.monitorBoxes) {
if (box.inside(b)) if (box.inside(b))
return true; return true;
} }
@ -608,7 +608,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
}; };
static auto INSIDE_LAYOUT_COORD = [this](const Vector2D& vec) -> bool { 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)) if (b.containsPoint(vec))
return true; return true;
} }
@ -619,7 +619,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
Vector2D leader; Vector2D leader;
float distanceSq = __FLT_MAX__; float distanceSq = __FLT_MAX__;
for (auto& b : currentMonitorLayout.monitorBoxes) { for (auto const& b : currentMonitorLayout.monitorBoxes) {
auto p = b.closestPoint(vec); auto p = b.closestPoint(vec);
auto distSq = p.distanceSq(vec); auto distSq = p.distanceSq(vec);
@ -673,7 +673,7 @@ void CPointerManager::damageIfSoftware() {
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors"); static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
for (auto& mw : monitorStates) { for (auto const& mw : monitorStates) {
if (mw->monitor.expired()) if (mw->monitor.expired())
continue; continue;
@ -748,7 +748,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
if (POINTER->boundOutput == "entire") { if (POINTER->boundOutput == "entire") {
// find x and y size of the entire space // find x and y size of the entire space
Vector2D bottomRight = {-9999999, -9999999}, topLeft = {9999999, 9999999}; 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 EXTENT = m->logicalBox().extent();
const auto POS = m->logicalBox().pos(); const auto POS = m->logicalBox().pos();
if (EXTENT.x > bottomRight.x) if (EXTENT.x > bottomRight.x)
@ -787,7 +787,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
void CPointerManager::onMonitorLayoutChange() { void CPointerManager::onMonitorLayoutChange() {
currentMonitorLayout.monitorBoxes.clear(); currentMonitorLayout.monitorBoxes.clear();
for (auto& m : g_pCompositor->m_vMonitors) { for (auto const& m : g_pCompositor->m_vMonitors) {
if (m->isMirror() || !m->m_bEnabled) if (m->isMirror() || !m->m_bEnabled)
continue; continue;

View file

@ -151,7 +151,7 @@ CProtocolManager::CProtocolManager() {
PROTO::toplevelExport = std::make_unique<CToplevelExportProtocol>(&hyprland_toplevel_export_manager_v1_interface, 2, "ToplevelExport"); 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"); 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) if (b->type() != Aquamarine::AQ_BACKEND_DRM)
continue; continue;

View file

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

View file

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

View file

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

View file

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

View file

@ -19,7 +19,7 @@ CEventLoopManager::CEventLoopManager(wl_display* display, wl_event_loop* wlEvent
} }
CEventLoopManager::~CEventLoopManager() { CEventLoopManager::~CEventLoopManager() {
for (auto& eventSource : m_sWayland.aqEventSources) { for (auto const& eventSource : m_sWayland.aqEventSources) {
wl_event_source_remove(eventSource); 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); 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(); 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())); 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() { 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()) if (t.strongRef() > 1 /* if it's 1, it was lost. Don't call it. */ && t->passed() && !t->cancelled())
t->call(t); t->call(t);
} }
@ -93,7 +93,7 @@ void CEventLoopManager::nudgeTimers() {
long nextTimerUs = 10 * 1000 * 1000; // 10s 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) if (const auto µs = t->leftUs(); µs < nextTimerUs)
nextTimerUs = µs; nextTimerUs = µs;
} }
@ -122,7 +122,7 @@ void CEventLoopManager::doLater(const std::function<void()>& fn) {
auto cpy = IDLE->fns; auto cpy = IDLE->fns;
IDLE->fns.clear(); IDLE->fns.clear();
IDLE->eventSource = nullptr; IDLE->eventSource = nullptr;
for (auto& c : cpy) { for (auto const& c : cpy) {
if (c) if (c)
c(); c();
} }

View file

@ -49,7 +49,7 @@ void CInputManager::recheckIdleInhibitorStatus() {
} }
// check manual user-set inhibitors // 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) if (w->m_eIdleInhibitMode == IDLEINHIBIT_NONE)
continue; continue;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,7 +14,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
parent = request->parent; parent = request->parent;
requested = request->requested; requested = request->requested;
for (auto& m : requested) { for (auto const& m : requested) {
if (!m->monitor || m->monitor->isBeingLeased) { if (!m->monitor || m->monitor->isBeingLeased) {
LOGM(ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->monitor ? m->monitor->szName : "null")); LOGM(ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->monitor ? m->monitor->szName : "null"));
resource->sendFinished(); resource->sendFinished();
@ -26,14 +26,14 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
LOGM(LOG, "Leasing outputs: {}", [this]() { LOGM(LOG, "Leasing outputs: {}", [this]() {
std::string roll; std::string roll;
for (auto& o : requested) { for (auto const& o : requested) {
roll += std::format("{} ", o->monitor->szName); roll += std::format("{} ", o->monitor->szName);
} }
return roll; return roll;
}()); }());
std::vector<SP<Aquamarine::IOutput>> outputs; std::vector<SP<Aquamarine::IOutput>> outputs;
for (auto& m : requested) { for (auto const& m : requested) {
outputs.emplace_back(m->monitor->output); outputs.emplace_back(m->monitor->output);
} }
@ -184,7 +184,7 @@ CDRMLeaseDeviceResource::CDRMLeaseDeviceResource(SP<CWpDrmLeaseDeviceV1> resourc
resource->sendDrmFd(fd); resource->sendDrmFd(fd);
close(fd); close(fd);
for (auto& m : PROTO::lease->primaryDevice->offeredOutputs) { for (auto const& m : PROTO::lease->primaryDevice->offeredOutputs) {
sendConnector(m.lock()); 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) { 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) if (b->type() != Aquamarine::AQ_BACKEND_DRM)
continue; continue;
@ -292,7 +292,7 @@ void CDRMLeaseProtocol::offer(SP<CMonitor> monitor) {
primaryDevice->offeredOutputs.emplace_back(monitor); primaryDevice->offeredOutputs.emplace_back(monitor);
for (auto& m : m_vManagers) { for (auto const& m : m_vManagers) {
m->sendConnector(monitor); m->sendConnector(monitor);
m->resource->sendDone(); m->resource->sendDone();
} }

View file

@ -37,7 +37,7 @@ void CWLRDataOffer::sendData() {
if (!source) if (!source)
return; return;
for (auto& m : source->mimes()) { for (auto const& m : source->mimes()) {
resource->sendOffer(m.c_str()); resource->sendOffer(m.c_str());
} }
} }
@ -191,7 +191,7 @@ CWLRDataControlManagerResource::CWLRDataControlManagerResource(SP<CZwlrDataContr
RESOURCE->self = RESOURCE; RESOURCE->self = RESOURCE;
device = RESOURCE; device = RESOURCE;
for (auto& s : sources) { for (auto const& s : sources) {
if (!s) if (!s)
continue; continue;
s->device = RESOURCE; s->device = RESOURCE;

View file

@ -103,7 +103,7 @@ void CFocusGrab::refocusKeyboard() {
return; return;
SP<CWLSurfaceResource> surface = nullptr; SP<CWLSurfaceResource> surface = nullptr;
for (auto& [surf, state] : m_mSurfaces) { for (auto const& [surf, state] : m_mSurfaces) {
if (state->state == CFocusGrabSurfaceState::Comitted) { if (state->state == CFocusGrabSurfaceState::Comitted) {
surface = surf.lock(); surface = surf.lock();
break; break;

View file

@ -30,7 +30,7 @@ CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resourc
LOGM(LOG, "CForeignToplevelList: finished"); 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) if (!w->m_bIsMapped || w->m_bFadingOut)
continue; 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) { 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) { 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)); m->onMap(std::any_cast<PHLWINDOW>(data));
} }
}); });
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any 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)); m->onUnmap(std::any_cast<PHLWINDOW>(data));
} }
}); });
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any 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)); m->onTitle(std::any_cast<PHLWINDOW>(data));
} }
}); });

View file

@ -179,7 +179,7 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa
PROTO::foreignToplevelWlr->onManagerResourceDestroy(this); 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) if (!w->m_bIsMapped || w->m_bFadingOut)
continue; 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) { 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) { static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
const auto PWINDOW = std::any_cast<PHLWINDOW>(data); const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
for (auto& m : m_vManagers) { for (auto const& m : m_vManagers) {
m->onMap(PWINDOW); m->onMap(PWINDOW);
} }
}); });
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) { static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
const auto PWINDOW = std::any_cast<PHLWINDOW>(data); const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
for (auto& m : m_vManagers) { for (auto const& m : m_vManagers) {
m->onUnmap(PWINDOW); m->onUnmap(PWINDOW);
} }
}); });
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) { static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
const auto PWINDOW = std::any_cast<PHLWINDOW>(data); const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
for (auto& m : m_vManagers) { for (auto const& m : m_vManagers) {
m->onTitle(PWINDOW); m->onTitle(PWINDOW);
} }
}); });
static auto P3 = g_pHookSystem->hookDynamic("activeWindow", [this](void* self, SCallbackInfo& info, std::any data) { static auto P3 = g_pHookSystem->hookDynamic("activeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
const auto PWINDOW = std::any_cast<PHLWINDOW>(data); const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
for (auto& m : m_vManagers) { for (auto const& m : m_vManagers) {
m->onNewFocus(PWINDOW); m->onNewFocus(PWINDOW);
} }
}); });
static auto P4 = g_pHookSystem->hookDynamic("moveWindow", [this](void* self, SCallbackInfo& info, std::any data) { 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)); 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); m->onMoveMonitor(PWINDOW);
} }
}); });
static auto P5 = g_pHookSystem->hookDynamic("fullscreen", [this](void* self, SCallbackInfo& info, std::any data) { static auto P5 = g_pHookSystem->hookDynamic("fullscreen", [this](void* self, SCallbackInfo& info, std::any data) {
const auto PWINDOW = std::any_cast<PHLWINDOW>(data); const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
for (auto& m : m_vManagers) { for (auto const& m : m_vManagers) {
m->onFullscreen(PWINDOW); m->onFullscreen(PWINDOW);
} }
}); });
@ -374,7 +374,7 @@ void CForeignToplevelWlrProtocol::destroyHandle(CForeignToplevelHandleWlr* handl
} }
PHLWINDOW CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res) { PHLWINDOW CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res) {
for (auto& h : m_vHandles) { for (auto const& h : m_vHandles) {
if (h->res() != res) if (h->res() != res)
continue; continue;

View file

@ -24,7 +24,7 @@ void CFractionalScaleProtocol::onManagerResourceDestroy(wl_resource* res) {
} }
void CFractionalScaleProtocol::onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, SP<CWLSurfaceResource> surface) { 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) { if (k == surface) {
LOGM(ERR, "Surface {:x} already has a fractionalScale addon", (uintptr_t)surface.get()); 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"); 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; return;
} }
for (auto& g : PROTO::gamma->m_vGammaControllers) { for (auto const& g : PROTO::gamma->m_vGammaControllers) {
if (g->pMonitor == pMonitor) { if (g->pMonitor == pMonitor) {
resource->sendFailed(); resource->sendFailed();
return; return;
@ -180,7 +180,7 @@ void CGammaControlProtocol::onGetGammaControl(CZwlrGammaControlManagerV1* pMgr,
} }
void CGammaControlProtocol::applyGammaToState(CMonitor* pMonitor) { void CGammaControlProtocol::applyGammaToState(CMonitor* pMonitor) {
for (auto& g : m_vGammaControllers) { for (auto const& g : m_vGammaControllers) {
if (g->getMonitor() != pMonitor) if (g->getMonitor() != pMonitor)
continue; continue;

View file

@ -54,8 +54,8 @@ void CGlobalShortcutsProtocol::destroyResource(CShortcutClient* client) {
} }
bool CGlobalShortcutsProtocol::isTaken(std::string appid, std::string trigger) { bool CGlobalShortcutsProtocol::isTaken(std::string appid, std::string trigger) {
for (auto& c : m_vClients) { for (auto const& c : m_vClients) {
for (auto& sh : c->shortcuts) { for (auto const& sh : c->shortcuts) {
if (sh->appid == appid && sh->id == trigger) { if (sh->appid == appid && sh->id == trigger) {
return true; 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) { void CGlobalShortcutsProtocol::sendGlobalShortcutEvent(std::string appid, std::string trigger, bool pressed) {
for (auto& c : m_vClients) { for (auto const& c : m_vClients) {
for (auto& sh : c->shortcuts) { for (auto const& sh : c->shortcuts) {
if (sh->appid == appid && sh->id == trigger) { if (sh->appid == appid && sh->id == trigger) {
timespec now; timespec now;
clock_gettime(CLOCK_MONOTONIC, &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> CGlobalShortcutsProtocol::getAllShortcuts() {
std::vector<SShortcut> copy; std::vector<SShortcut> copy;
for (auto& c : m_vClients) { for (auto const& c : m_vClients) {
for (auto& sh : c->shortcuts) { for (auto const& sh : c->shortcuts) {
copy.push_back(*sh); copy.push_back(*sh);
} }
} }

View file

@ -86,14 +86,14 @@ void CIdleNotifyProtocol::onGetNotification(CExtIdleNotifierV1* pMgr, uint32_t i
} }
void CIdleNotifyProtocol::onActivity() { void CIdleNotifyProtocol::onActivity() {
for (auto& n : m_vNotifications) { for (auto const& n : m_vNotifications) {
n->onActivity(); n->onActivity();
} }
} }
void CIdleNotifyProtocol::setInhibit(bool inhibited) { void CIdleNotifyProtocol::setInhibit(bool inhibited) {
isInhibited = inhibited; isInhibited = inhibited;
for (auto& n : m_vNotifications) { for (auto const& n : m_vNotifications) {
n->onActivity(); n->onActivity();
} }
} }

View file

@ -268,7 +268,7 @@ wl_client* CInputMethodV2::grabClient() {
if (grabs.empty()) if (grabs.empty())
return nullptr; return nullptr;
for (auto& gw : grabs) { for (auto const& gw : grabs) {
auto g = gw.lock(); auto g = gw.lock();
if (!g) if (!g)
@ -282,7 +282,7 @@ wl_client* CInputMethodV2::grabClient() {
void CInputMethodV2::sendInputRectangle(const CBox& box) { void CInputMethodV2::sendInputRectangle(const CBox& box) {
inputRectangle = box; inputRectangle = box;
for (auto& wp : popups) { for (auto const& wp : popups) {
auto p = wp.lock(); auto p = wp.lock();
if (!p) 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) { 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(); auto g = gw.lock();
if (!g) 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) { 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(); auto g = gw.lock();
if (!g) if (!g)
@ -315,7 +315,7 @@ void CInputMethodV2::sendMods(uint32_t depressed, uint32_t latched, uint32_t loc
} }
void CInputMethodV2::setKeyboard(SP<IKeyboard> keyboard) { void CInputMethodV2::setKeyboard(SP<IKeyboard> keyboard) {
for (auto& gw : grabs) { for (auto const& gw : grabs) {
auto g = gw.lock(); auto g = gw.lock();
if (!g) if (!g)

View file

@ -31,8 +31,8 @@ CDMABUFFormatTable::CDMABUFFormatTable(SDMABUFTranche _rendererTranche, std::vec
size_t i = 0; size_t i = 0;
rendererTranche.indicies.clear(); rendererTranche.indicies.clear();
for (auto& fmt : rendererTranche.formats) { for (auto const& fmt : rendererTranche.formats) {
for (auto& mod : fmt.modifiers) { for (auto const& mod : fmt.modifiers) {
auto format = std::make_pair<>(fmt.drmFormat, mod); auto format = std::make_pair<>(fmt.drmFormat, mod);
auto [_, inserted] = formats.insert(format); auto [_, inserted] = formats.insert(format);
if (inserted) { if (inserted) {
@ -53,8 +53,8 @@ CDMABUFFormatTable::CDMABUFFormatTable(SDMABUFTranche _rendererTranche, std::vec
for (auto& [monitor, tranche] : monitorTranches) { for (auto& [monitor, tranche] : monitorTranches) {
tranche.indicies.clear(); tranche.indicies.clear();
for (auto& fmt : tranche.formats) { for (auto const& fmt : tranche.formats) {
for (auto& mod : fmt.modifiers) { for (auto const& mod : fmt.modifiers) {
// apparently these can implode on planes, so dont use them // apparently these can implode on planes, so dont use them
if (mod == DRM_FORMAT_MOD_INVALID || mod == DRM_FORMAT_MOD_LINEAR) if (mod == DRM_FORMAT_MOD_INVALID || mod == DRM_FORMAT_MOD_LINEAR)
continue; continue;
@ -270,7 +270,7 @@ bool CLinuxDMABBUFParamsResource::verify() {
} }
bool empty = false; bool empty = false;
for (auto& plane : attrs->fds) { for (auto const& plane : attrs->fds) {
if (empty && plane != -1) { if (empty && plane != -1) {
resource->error(ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT, "Gap in planes"); resource->error(ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT, "Gap in planes");
return false; return false;
@ -402,8 +402,8 @@ bool CLinuxDMABUFResource::good() {
} }
void CLinuxDMABUFResource::sendMods() { void CLinuxDMABUFResource::sendMods() {
for (auto& fmt : PROTO::linuxDma->formatTable->rendererTranche.formats) { for (auto const& fmt : PROTO::linuxDma->formatTable->rendererTranche.formats) {
for (auto& mod : fmt.modifiers) { for (auto const& mod : fmt.modifiers) {
if (resource->version() < 3) { if (resource->version() < 3) {
if (mod == DRM_FORMAT_MOD_INVALID || mod == DRM_FORMAT_MOD_LINEAR) if (mod == DRM_FORMAT_MOD_INVALID || mod == DRM_FORMAT_MOD_LINEAR)
resource->sendFormat(fmt.drmFormat); 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 // this assumes there's only 1 device used for both scanout and rendering
// also that each monitor never changes its primary plane // 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{ auto tranche = SDMABUFTranche{
.device = mainDevice, .device = mainDevice,
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT, .flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
@ -505,7 +505,7 @@ void CLinuxDMABufV1Protocol::resetFormatTable() {
// this might be a big copy // this might be a big copy
auto newFormatTable = std::make_unique<CDMABUFFormatTable>(formatTable->rendererTranche, formatTable->monitorTranches); 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); feedback->resource->sendFormatTable(newFormatTable->tableFD, newFormatTable->tableSize);
if (feedback->lastFeedbackWasScanout) { if (feedback->lastFeedbackWasScanout) {
SP<CMonitor> mon; SP<CMonitor> mon;
@ -562,7 +562,7 @@ void CLinuxDMABufV1Protocol::destroyResource(CLinuxDMABuffer* resource) {
void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface, SP<CMonitor> pMonitor) { void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface, SP<CMonitor> pMonitor) {
SP<CLinuxDMABUFFeedbackResource> feedbackResource; SP<CLinuxDMABUFFeedbackResource> feedbackResource;
for (auto& f : m_vFeedbacks) { for (auto const& f : m_vFeedbacks) {
if (f->surface != surface) if (f->surface != surface)
continue; continue;

View file

@ -60,11 +60,11 @@ CMesaDRMResource::CMesaDRMResource(SP<CWlDrm> resource_) : resource(resource_) {
uint64_t mod = DRM_FORMAT_MOD_INVALID; uint64_t mod = DRM_FORMAT_MOD_INVALID;
auto fmts = g_pHyprOpenGL->getDRMFormats(); auto fmts = g_pHyprOpenGL->getDRMFormats();
for (auto& f : fmts) { for (auto const& f : fmts) {
if (f.drmFormat != fmt) if (f.drmFormat != fmt)
continue; continue;
for (auto& m : f.modifiers) { for (auto const& m : f.modifiers) {
if (m == DRM_FORMAT_MOD_LINEAR) if (m == DRM_FORMAT_MOD_LINEAR)
continue; continue;
@ -100,7 +100,7 @@ CMesaDRMResource::CMesaDRMResource(SP<CWlDrm> resource_) : resource(resource_) {
resource->sendCapabilities(WL_DRM_CAPABILITY_PRIME); resource->sendCapabilities(WL_DRM_CAPABILITY_PRIME);
auto fmts = g_pHyprOpenGL->getDRMFormats(); auto fmts = g_pHyprOpenGL->getDRMFormats();
for (auto& fmt : fmts) { for (auto const& fmt : fmts) {
resource->sendFormat(fmt.drmFormat); resource->sendFormat(fmt.drmFormat);
} }
} }

View file

@ -28,7 +28,7 @@ COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : resource(re
}); });
// send all heads at start // 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) if (m.get() == g_pCompositor->m_pUnsafeOutput)
continue; continue;
@ -67,7 +67,7 @@ void COutputManager::ensureMonitorSent(CMonitor* pMonitor) {
if (pMonitor == g_pCompositor->m_pUnsafeOutput) if (pMonitor == g_pCompositor->m_pUnsafeOutput)
return; return;
for (auto& hw : heads) { for (auto const& hw : heads) {
auto h = hw.lock(); auto h = hw.lock();
if (!h) if (!h)
@ -96,7 +96,7 @@ COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, CMonitor* pMonitor_) :
listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any d) { listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any d) {
resource->sendFinished(); resource->sendFinished();
for (auto& mw : modes) { for (auto const& mw : modes) {
auto m = mw.lock(); auto m = mw.lock();
if (!m) if (!m)
@ -106,7 +106,7 @@ COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, CMonitor* pMonitor_) :
} }
pMonitor = nullptr; pMonitor = nullptr;
for (auto& m : PROTO::outputManagement->m_vManagers) { for (auto const& m : PROTO::outputManagement->m_vManagers) {
m->sendDone(); m->sendDone();
} }
}); });
@ -147,7 +147,7 @@ void COutputHead::sendAllData() {
if (modes.empty()) { if (modes.empty()) {
if (!pMonitor->output->modes.empty()) { if (!pMonitor->output->modes.empty()) {
for (auto& m : pMonitor->output->modes) { for (auto const& m : pMonitor->output->modes) {
makeAndSendNewMode(m); makeAndSendNewMode(m);
} }
} else if (pMonitor->output->state->state().customMode) { } else if (pMonitor->output->state->state().customMode) {
@ -158,7 +158,7 @@ void COutputHead::sendAllData() {
// send current mode // send current mode
if (pMonitor->m_bEnabled) { if (pMonitor->m_bEnabled) {
for (auto& mw : modes) { for (auto const& mw : modes) {
auto m = mw.lock(); auto m = mw.lock();
if (!m) 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); resource->sendAdaptiveSync(pMonitor->vrrActive ? ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED : ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_DISABLED);
if (pMonitor->m_bEnabled) { if (pMonitor->m_bEnabled) {
for (auto& mw : modes) { for (auto const& mw : modes) {
auto m = mw.lock(); auto m = mw.lock();
if (!m) if (!m)
@ -346,7 +346,7 @@ bool COutputConfiguration::applyTestConfiguration(bool test) {
LOGM(LOG, "Applying configuration"); LOGM(LOG, "Applying configuration");
for (auto& headw : heads) { for (auto const& headw : heads) {
auto head = headw.lock(); auto head = headw.lock();
if (!head) if (!head)
@ -577,15 +577,15 @@ void COutputManagementProtocol::destroyResource(COutputConfigurationHead* resour
} }
void COutputManagementProtocol::updateAllOutputs() { void COutputManagementProtocol::updateAllOutputs() {
for (auto& m : g_pCompositor->m_vRealMonitors) { for (auto const& m : g_pCompositor->m_vRealMonitors) {
for (auto& mgr : m_vManagers) { for (auto const& mgr : m_vManagers) {
mgr->ensureMonitorSent(m.get()); mgr->ensureMonitorSent(m.get());
} }
} }
} }
SP<COutputHead> COutputManagementProtocol::headFromResource(wl_resource* r) { SP<COutputHead> COutputManagementProtocol::headFromResource(wl_resource* r) {
for (auto& h : m_vHeads) { for (auto const& h : m_vHeads) {
if (h->resource->resource() == r) if (h->resource->resource() == r)
return h; return h;
} }
@ -594,7 +594,7 @@ SP<COutputHead> COutputManagementProtocol::headFromResource(wl_resource* r) {
} }
SP<COutputMode> COutputManagementProtocol::modeFromResource(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) if (h->resource->resource() == r)
return h; 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()); 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) if (sw->resource->client() != FOCUSEDCLIENT)
continue; continue;
@ -125,7 +125,7 @@ void CPointerGesturesProtocol::swipeUpdate(uint32_t timeMs, const Vector2D& delt
const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client(); const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
for (auto& sw : m_vSwipes) { for (auto const& sw : m_vSwipes) {
if (sw->resource->client() != FOCUSEDCLIENT) if (sw->resource->client() != FOCUSEDCLIENT)
continue; continue;
@ -141,7 +141,7 @@ void CPointerGesturesProtocol::swipeEnd(uint32_t timeMs, bool cancelled) {
const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock()); 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) if (sw->resource->client() != FOCUSEDCLIENT)
continue; 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()); 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) if (sw->resource->client() != FOCUSEDCLIENT)
continue; continue;
@ -171,7 +171,7 @@ void CPointerGesturesProtocol::pinchUpdate(uint32_t timeMs, const Vector2D& delt
const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client(); const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
for (auto& sw : m_vPinches) { for (auto const& sw : m_vPinches) {
if (sw->resource->client() != FOCUSEDCLIENT) if (sw->resource->client() != FOCUSEDCLIENT)
continue; continue;
@ -187,7 +187,7 @@ void CPointerGesturesProtocol::pinchEnd(uint32_t timeMs, bool cancelled) {
const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock()); 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) if (sw->resource->client() != FOCUSEDCLIENT)
continue; 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()); 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) if (sw->resource->client() != FOCUSEDCLIENT)
continue; continue;
@ -219,7 +219,7 @@ void CPointerGesturesProtocol::holdEnd(uint32_t timeMs, bool cancelled) {
const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock()); 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) if (sw->resource->client() != FOCUSEDCLIENT)
continue; continue;

View file

@ -114,11 +114,11 @@ void CPresentationProtocol::onPresented(CMonitor* pMonitor, timespec* when, uint
when = &now; when = &now;
} }
for (auto& feedback : m_vFeedbacks) { for (auto const& feedback : m_vFeedbacks) {
if (!feedback->surface) if (!feedback->surface)
continue; continue;
for (auto& data : m_vQueue) { for (auto const& data : m_vQueue) {
if (!data->surface || data->surface != feedback->surface) if (!data->surface || data->surface != feedback->surface)
continue; continue;

View file

@ -38,7 +38,7 @@ void CPrimarySelectionOffer::sendData() {
if (!source) if (!source)
return; return;
for (auto& m : source->mimes()) { for (auto const& m : source->mimes()) {
resource->sendOffer(m.c_str()); resource->sendOffer(m.c_str());
} }
} }
@ -177,7 +177,7 @@ CPrimarySelectionManager::CPrimarySelectionManager(SP<CZwpPrimarySelectionDevice
RESOURCE->self = RESOURCE; RESOURCE->self = RESOURCE;
device = RESOURCE; device = RESOURCE;
for (auto& s : sources) { for (auto const& s : sources) {
if (!s) if (!s)
continue; continue;
s->device = RESOURCE; s->device = RESOURCE;
@ -272,7 +272,7 @@ void CPrimarySelectionProtocol::sendSelectionToDevice(SP<CPrimarySelectionDevice
} }
void CPrimarySelectionProtocol::setSelection(SP<IDataSource> source) { void CPrimarySelectionProtocol::setSelection(SP<IDataSource> source) {
for (auto& o : m_vOffers) { for (auto const& o : m_vOffers) {
if (o->source && o->source->hasDnd()) if (o->source && o->source->hasDnd())
continue; continue;
o->dead = true; o->dead = true;
@ -321,7 +321,7 @@ void CPrimarySelectionProtocol::updateSelection() {
} }
void CPrimarySelectionProtocol::onPointerFocus() { void CPrimarySelectionProtocol::onPointerFocus() {
for (auto& o : m_vOffers) { for (auto const& o : m_vOffers) {
o->dead = true; 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(); const auto FOCUSED = g_pSeatManager->state.pointerFocusResource->client();
for (auto& rp : m_vRelativePointers) { for (auto const& rp : m_vRelativePointers) {
if (FOCUSED != rp->client()) if (FOCUSED != rp->client())
continue; continue;

View file

@ -155,7 +155,7 @@ void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_
lockedSWCursors = true; lockedSWCursors = true;
// TODO: make it per-monitor // TODO: make it per-monitor
if (!PROTO::screencopy->m_bTimerArmed) { if (!PROTO::screencopy->m_bTimerArmed) {
for (auto& m : g_pCompositor->m_vMonitors) { for (auto const& m : g_pCompositor->m_vMonitors) {
g_pPointerManager->lockSoftwareForMonitor(m); g_pPointerManager->lockSoftwareForMonitor(m);
} }
PROTO::screencopy->m_bTimerArmed = true; PROTO::screencopy->m_bTimerArmed = true;
@ -365,7 +365,7 @@ CScreencopyProtocol::CScreencopyProtocol(const wl_interface* iface, const int& v
std::nullopt, std::nullopt,
[this](SP<CEventLoopTimer> self, void* data) { [this](SP<CEventLoopTimer> self, void* data) {
// TODO: make it per-monitor // TODO: make it per-monitor
for (auto& m : g_pCompositor->m_vMonitors) { for (auto const& m : g_pCompositor->m_vMonitors) {
g_pPointerManager->unlockSoftwareForMonitor(m); g_pPointerManager->unlockSoftwareForMonitor(m);
} }
m_bTimerArmed = false; m_bTimerArmed = false;
@ -411,7 +411,7 @@ void CScreencopyProtocol::onOutputCommit(CMonitor* pMonitor) {
std::vector<WP<CScreencopyFrame>> framesToRemove; std::vector<WP<CScreencopyFrame>> framesToRemove;
// share frame if correct output // share frame if correct output
for (auto& f : m_vFramesAwaitingWrite) { for (auto const& f : m_vFramesAwaitingWrite) {
if (!f->pMonitor || !f->buffer) { if (!f->pMonitor || !f->buffer) {
framesToRemove.push_back(f); framesToRemove.push_back(f);
continue; continue;
@ -428,7 +428,7 @@ void CScreencopyProtocol::onOutputCommit(CMonitor* pMonitor) {
framesToRemove.push_back(f); framesToRemove.push_back(f);
} }
for (auto& f : framesToRemove) { for (auto const& f : framesToRemove) {
destroyResource(f.get()); destroyResource(f.get());
} }
} }

View file

@ -187,7 +187,7 @@ void CSessionLockProtocol::onGetLockSurface(CExtSessionLockV1* lock, uint32_t id
auto PMONITOR = CWLOutputResource::fromResource(output)->monitor.get(); auto PMONITOR = CWLOutputResource::fromResource(output)->monitor.get();
SP<CSessionLock> sessionLock; SP<CSessionLock> sessionLock;
for (auto& l : m_vLocks) { for (auto const& l : m_vLocks) {
if (l->resource.get() == lock) { if (l->resource.get() == lock) {
sessionLock = l; sessionLock = l;
break; break;

View file

@ -48,7 +48,7 @@ void CKeyboardShortcutsInhibitProtocol::onInhibit(CZwpKeyboardShortcutsInhibitMa
SP<CWLSurfaceResource> surf = CWLSurfaceResource::fromResource(surface); SP<CWLSurfaceResource> surf = CWLSurfaceResource::fromResource(surface);
const auto CLIENT = pMgr->client(); const auto CLIENT = pMgr->client();
for (auto& in : m_vInhibitors) { for (auto const& in : m_vInhibitors) {
if (in->surface() != surf) if (in->surface() != surf)
continue; 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()) if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus.lock()); PWINDOW && PWINDOW->m_sWindowData.noShortcutsInhibit.valueOrDefault())
return false; return false;
for (auto& in : m_vInhibitors) { for (auto const& in : m_vInhibitors) {
if (in->surface() != g_pCompositor->m_pLastFocus) if (in->surface() != g_pCompositor->m_pLastFocus)
continue; continue;

View file

@ -96,7 +96,7 @@ bool CTabletPadV2Resource::good() {
void CTabletPadV2Resource::sendData() { 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 // 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()); resource->sendPath(p.c_str());
} }
@ -140,7 +140,7 @@ void CTabletV2Resource::sendData() {
resource->sendName(tablet->deviceName.c_str()); resource->sendName(tablet->deviceName.c_str());
resource->sendId(tablet->aq()->usbVendorID, tablet->aq()->usbProductID); 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()); resource->sendPath(p.c_str());
} }
@ -287,21 +287,21 @@ void CTabletSeat::sendTablet(SP<CTablet> tablet) {
} }
void CTabletSeat::sendData() { void CTabletSeat::sendData() {
for (auto& tw : PROTO::tablet->tablets) { for (auto const& tw : PROTO::tablet->tablets) {
if (tw.expired()) if (tw.expired())
continue; continue;
sendTablet(tw.lock()); sendTablet(tw.lock());
} }
for (auto& tw : PROTO::tablet->tools) { for (auto const& tw : PROTO::tablet->tools) {
if (tw.expired()) if (tw.expired())
continue; continue;
sendTool(tw.lock()); sendTool(tw.lock());
} }
for (auto& tw : PROTO::tablet->pads) { for (auto const& tw : PROTO::tablet->pads) {
if (tw.expired()) if (tw.expired())
continue; continue;
@ -367,7 +367,7 @@ void CTabletV2Protocol::onGetSeat(CZwpTabletManagerV2* pMgr, uint32_t id, wl_res
} }
void CTabletV2Protocol::registerDevice(SP<CTablet> tablet) { void CTabletV2Protocol::registerDevice(SP<CTablet> tablet) {
for (auto& s : m_vSeats) { for (auto const& s : m_vSeats) {
s->sendTablet(tablet); s->sendTablet(tablet);
} }
@ -375,7 +375,7 @@ void CTabletV2Protocol::registerDevice(SP<CTablet> tablet) {
} }
void CTabletV2Protocol::registerDevice(SP<CTabletTool> tool) { void CTabletV2Protocol::registerDevice(SP<CTabletTool> tool) {
for (auto& s : m_vSeats) { for (auto const& s : m_vSeats) {
s->sendTool(tool); s->sendTool(tool);
} }
@ -383,7 +383,7 @@ void CTabletV2Protocol::registerDevice(SP<CTabletTool> tool) {
} }
void CTabletV2Protocol::registerDevice(SP<CTabletPad> pad) { void CTabletV2Protocol::registerDevice(SP<CTabletPad> pad) {
for (auto& s : m_vSeats) { for (auto const& s : m_vSeats) {
s->sendPad(pad); s->sendPad(pad);
} }
@ -391,7 +391,7 @@ void CTabletV2Protocol::registerDevice(SP<CTabletPad> pad) {
} }
void CTabletV2Protocol::unregisterDevice(SP<CTablet> tablet) { void CTabletV2Protocol::unregisterDevice(SP<CTablet> tablet) {
for (auto& t : m_vTablets) { for (auto const& t : m_vTablets) {
if (t->tablet == tablet) { if (t->tablet == tablet) {
t->resource->sendRemoved(); t->resource->sendRemoved();
t->inert = true; t->inert = true;
@ -401,7 +401,7 @@ void CTabletV2Protocol::unregisterDevice(SP<CTablet> tablet) {
} }
void CTabletV2Protocol::unregisterDevice(SP<CTabletTool> tool) { void CTabletV2Protocol::unregisterDevice(SP<CTabletTool> tool) {
for (auto& t : m_vTools) { for (auto const& t : m_vTools) {
if (t->tool == tool) { if (t->tool == tool) {
t->resource->sendRemoved(); t->resource->sendRemoved();
t->inert = true; t->inert = true;
@ -411,7 +411,7 @@ void CTabletV2Protocol::unregisterDevice(SP<CTabletTool> tool) {
} }
void CTabletV2Protocol::unregisterDevice(SP<CTabletPad> pad) { void CTabletV2Protocol::unregisterDevice(SP<CTabletPad> pad) {
for (auto& t : m_vPads) { for (auto const& t : m_vPads) {
if (t->pad == pad) { if (t->pad == pad) {
t->resource->sendRemoved(); t->resource->sendRemoved();
t->inert = true; t->inert = true;
@ -426,7 +426,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() {
std::erase_if(pads, [](const auto& e) { return e.expired(); }); std::erase_if(pads, [](const auto& e) { return e.expired(); });
// now we need to send removed events // now we need to send removed events
for (auto& t : m_vTablets) { for (auto const& t : m_vTablets) {
if (!t->tablet.expired() || t->inert) if (!t->tablet.expired() || t->inert)
continue; continue;
@ -434,7 +434,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() {
t->inert = true; t->inert = true;
} }
for (auto& t : m_vTools) { for (auto const& t : m_vTools) {
if (!t->tool.expired() || t->inert) if (!t->tool.expired() || t->inert)
continue; continue;
@ -448,7 +448,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() {
t->inert = true; t->inert = true;
} }
for (auto& t : m_vPads) { for (auto const& t : m_vPads) {
if (!t->pad.expired() || t->inert) if (!t->pad.expired() || t->inert)
continue; continue;
@ -458,7 +458,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() {
} }
void CTabletV2Protocol::pressure(SP<CTabletTool> tool, double value) { 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) if (t->tool != tool || !t->current)
continue; continue;
@ -468,7 +468,7 @@ void CTabletV2Protocol::pressure(SP<CTabletTool> tool, double value) {
} }
void CTabletV2Protocol::distance(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) if (t->tool != tool || !t->current)
continue; continue;
@ -478,7 +478,7 @@ void CTabletV2Protocol::distance(SP<CTabletTool> tool, double value) {
} }
void CTabletV2Protocol::rotation(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) if (t->tool != tool || !t->current)
continue; continue;
@ -488,7 +488,7 @@ void CTabletV2Protocol::rotation(SP<CTabletTool> tool, double value) {
} }
void CTabletV2Protocol::slider(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) if (t->tool != tool || !t->current)
continue; continue;
@ -498,7 +498,7 @@ void CTabletV2Protocol::slider(SP<CTabletTool> tool, double value) {
} }
void CTabletV2Protocol::wheel(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) if (t->tool != tool || !t->current)
continue; continue;
@ -508,7 +508,7 @@ void CTabletV2Protocol::wheel(SP<CTabletTool> tool, double value) {
} }
void CTabletV2Protocol::tilt(SP<CTabletTool> tool, const Vector2D& 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) if (t->tool != tool || !t->current)
continue; continue;
@ -518,7 +518,7 @@ void CTabletV2Protocol::tilt(SP<CTabletTool> tool, const Vector2D& value) {
} }
void CTabletV2Protocol::up(SP<CTabletTool> tool) { void CTabletV2Protocol::up(SP<CTabletTool> tool) {
for (auto& t : m_vTools) { for (auto const& t : m_vTools) {
if (t->tool != tool || !t->current) if (t->tool != tool || !t->current)
continue; continue;
@ -528,7 +528,7 @@ void CTabletV2Protocol::up(SP<CTabletTool> tool) {
} }
void CTabletV2Protocol::down(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) if (t->tool != tool || !t->current)
continue; continue;
@ -545,7 +545,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP
SP<CTabletToolV2Resource> toolResource; SP<CTabletToolV2Resource> toolResource;
SP<CTabletV2Resource> tabletResource; SP<CTabletV2Resource> tabletResource;
for (auto& t : m_vTools) { for (auto const& t : m_vTools) {
if (t->tool != tool || t->resource->client() != CLIENT) if (t->tool != tool || t->resource->client() != CLIENT)
continue; continue;
@ -559,7 +559,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP
toolResource = t; toolResource = t;
for (auto& tab : m_vTablets) { for (auto const& tab : m_vTablets) {
if (tab->tablet != tablet) if (tab->tablet != tablet)
continue; continue;
@ -587,7 +587,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP
} }
void CTabletV2Protocol::proximityOut(SP<CTabletTool> tool) { void CTabletV2Protocol::proximityOut(SP<CTabletTool> tool) {
for (auto& t : m_vTools) { for (auto const& t : m_vTools) {
if (t->tool != tool || !t->current) if (t->tool != tool || !t->current)
continue; continue;
@ -599,7 +599,7 @@ void CTabletV2Protocol::proximityOut(SP<CTabletTool> tool) {
} }
void CTabletV2Protocol::buttonTool(SP<CTabletTool> tool, uint32_t button, uint32_t state) { 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) if (t->tool != tool || !t->current)
continue; continue;
@ -610,7 +610,7 @@ void CTabletV2Protocol::buttonTool(SP<CTabletTool> tool, uint32_t button, uint32
} }
void CTabletV2Protocol::motion(SP<CTabletTool> tool, const Vector2D& value) { 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) if (t->tool != tool || !t->current)
continue; 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) { 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) if (t->pad != pad)
continue; continue;
if (t->groups.size() <= group) { 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) { 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) if (t->pad != pad)
continue; continue;
t->resource->sendButton(timeMs, button, zwpTabletToolV2ButtonState{state}); t->resource->sendButton(timeMs, button, zwpTabletToolV2ButtonState{state});

View file

@ -38,7 +38,7 @@ void CTearingControlProtocol::onControllerDestroy(CTearingControl* control) {
} }
void CTearingControlProtocol::onWindowDestroy(PHLWINDOW pWindow) { void CTearingControlProtocol::onWindowDestroy(PHLWINDOW pWindow) {
for (auto& c : m_vTearingControllers) { for (auto const& c : m_vTearingControllers) {
if (c->pWindow.lock() == pWindow) if (c->pWindow.lock() == pWindow)
c->pWindow.reset(); c->pWindow.reset();
} }
@ -52,7 +52,7 @@ CTearingControl::CTearingControl(SP<CWpTearingControlV1> resource_, SP<CWLSurfac
resource->setDestroy([this](CWpTearingControlV1* res) { PROTO::tearing->onControllerDestroy(this); }); resource->setDestroy([this](CWpTearingControlV1* res) { PROTO::tearing->onControllerDestroy(this); });
resource->setSetPresentationHint([this](CWpTearingControlV1* res, wpTearingControlV1PresentationHint hint) { this->onHint(hint); }); 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_) { if (w->m_pWLSurface->resource() == surf_) {
pWindow = w; pWindow = w;
break; break;

View file

@ -369,7 +369,7 @@ void CToplevelExportProtocol::onOutputCommit(CMonitor* pMonitor) {
std::vector<WP<CToplevelExportFrame>> framesToRemove; std::vector<WP<CToplevelExportFrame>> framesToRemove;
// share frame if correct output // share frame if correct output
for (auto& f : m_vFramesAwaitingWrite) { for (auto const& f : m_vFramesAwaitingWrite) {
if (!f->pWindow || !validMapped(f->pWindow)) { if (!f->pWindow || !validMapped(f->pWindow)) {
framesToRemove.push_back(f); framesToRemove.push_back(f);
continue; continue;
@ -393,13 +393,13 @@ void CToplevelExportProtocol::onOutputCommit(CMonitor* pMonitor) {
framesToRemove.push_back(f); framesToRemove.push_back(f);
} }
for (auto& f : framesToRemove) { for (auto const& f : framesToRemove) {
destroyResource(f.get()); destroyResource(f.get());
} }
} }
void CToplevelExportProtocol::onWindowUnmap(PHLWINDOW pWindow) { void CToplevelExportProtocol::onWindowUnmap(PHLWINDOW pWindow) {
for (auto& f : m_vFrames) { for (auto const& f : m_vFrames) {
if (f->pWindow == pWindow) if (f->pWindow == pWindow)
f->pWindow.reset(); f->pWindow.reset();
} }

View file

@ -108,7 +108,7 @@ void CVirtualKeyboardV1Resource::releasePressed() {
timespec now; timespec now;
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
for (auto& p : pressed) { for (auto const& p : pressed) {
events.key.emit(IKeyboard::SKeyEvent{ events.key.emit(IKeyboard::SKeyEvent{
.timeMs = now.tv_sec * 1000 + now.tv_nsec / 1000000, .timeMs = now.tv_sec * 1000 + now.tv_nsec / 1000000,
.keycode = p, .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 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) { static auto P3 = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
const auto PMONITOR = std::any_cast<CMonitor*>(param); const auto PMONITOR = std::any_cast<CMonitor*>(param);
for (auto& o : m_vXDGOutputs) { for (auto const& o : m_vXDGOutputs) {
if (o->monitor == PMONITOR) if (o->monitor == PMONITOR)
o->monitor = nullptr; o->monitor = nullptr;
} }
@ -84,7 +84,7 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32
} }
void CXDGOutputProtocol::updateAllOutputs() { void CXDGOutputProtocol::updateAllOutputs() {
for (auto& o : m_vXDGOutputs) { for (auto const& o : m_vXDGOutputs) {
if (!o->monitor) if (!o->monitor)
continue; continue;

View file

@ -388,7 +388,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
g_pCompositor->m_vWindows.emplace_back(CWindow::create(self.lock())); g_pCompositor->m_vWindows.emplace_back(CWindow::create(self.lock()));
for (auto& p : popups) { for (auto const& p : popups) {
if (!p) if (!p)
continue; continue;
events.newPopup.emit(p); events.newPopup.emit(p);
@ -714,7 +714,7 @@ CXDGShellProtocol::CXDGShellProtocol(const wl_interface* iface, const int& ver,
grab->keyboard = true; grab->keyboard = true;
grab->pointer = true; grab->pointer = true;
grab->setCallback([this]() { grab->setCallback([this]() {
for (auto& g : grabbed) { for (auto const& g : grabbed) {
g->done(); g->done();
} }
grabbed.clear(); grabbed.clear();
@ -779,7 +779,7 @@ void CXDGShellProtocol::addOrStartGrab(SP<CXDGPopupResource> popup) {
void CXDGShellProtocol::onPopupDestroy(WP<CXDGPopupResource> popup) { void CXDGShellProtocol::onPopupDestroy(WP<CXDGPopupResource> popup) {
if (popup == grabOwner) { if (popup == grabOwner) {
g_pSeatManager->setGrab(nullptr); g_pSeatManager->setGrab(nullptr);
for (auto& g : grabbed) { for (auto const& g : grabbed) {
g->done(); g->done();
} }
grabbed.clear(); grabbed.clear();

View file

@ -241,7 +241,7 @@ void CWLSurfaceResource::frame(timespec* now) {
if (callbacks.empty()) if (callbacks.empty())
return; return;
for (auto& c : callbacks) { for (auto const& c : callbacks) {
c->send(now); c->send(now);
} }
@ -257,7 +257,7 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> nodes, std
std::vector<SP<CWLSurfaceResource>> nodes2; std::vector<SP<CWLSurfaceResource>> nodes2;
// first, gather all nodes below // 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(); }); std::erase_if(n->subsurfaces, [](const auto& e) { return e.expired(); });
// subsurfaces is sorted lowest -> highest // subsurfaces is sorted lowest -> highest
for (auto const& c : n->subsurfaces) { 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)); }, void* data) { ((std::vector<std::pair<SP<CWLSurfaceResource>, Vector2D>>*)data)->emplace_back(std::make_pair<>(surf, offset)); },
&surfs); &surfs);
for (auto& [surf, pos] : surfs | std::views::reverse) { for (auto const& [surf, pos] : surfs | std::views::reverse) {
if (!allowsInput) { if (!allowsInput) {
const auto BOX = CBox{pos, surf->current.size}; const auto BOX = CBox{pos, surf->current.size};
if (BOX.containsPoint(localCoords)) if (BOX.containsPoint(localCoords))

View file

@ -80,7 +80,7 @@ void CWLDataOfferResource::sendData() {
resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE); 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); LOGM(LOG, " | offer {:x} supports mime {}", (uintptr_t)this, m);
resource->sendOffer(m.c_str()); 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) { IWaylandProtocol(iface, ver, name), monitor(pMonitor), szName(pMonitor->szName) {
listeners.modeChanged = monitor->events.modeChanged.registerListener([this](std::any d) { listeners.modeChanged = monitor->events.modeChanged.registerListener([this](std::any d) {
for (auto& o : m_vOutputs) { for (auto const& o : m_vOutputs) {
o->updateState(); o->updateState();
} }
}); });
@ -95,7 +95,7 @@ void CWLOutputProtocol::destroyResource(CWLOutputResource* resource) {
} }
SP<CWLOutputResource> CWLOutputProtocol::outputResourceFrom(wl_client* client) { SP<CWLOutputResource> CWLOutputProtocol::outputResourceFrom(wl_client* client) {
for (auto& r : m_vOutputs) { for (auto const& r : m_vOutputs) {
if (r->client() != client) if (r->client() != client)
continue; continue;

View file

@ -525,7 +525,7 @@ void CWLSeatProtocol::updateCapabilities(uint32_t caps) {
currentCaps = caps; currentCaps = caps;
for (auto& s : m_vSeatResources) { for (auto const& s : m_vSeatResources) {
s->sendCapabilities(caps); s->sendCapabilities(caps);
} }
} }
@ -534,7 +534,7 @@ void CWLSeatProtocol::updateKeymap() {
if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD)) if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
return; return;
for (auto& k : m_vKeyboards) { for (auto const& k : m_vKeyboards) {
k->sendKeymap(g_pSeatManager->keyboard.lock()); 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)) if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
return; return;
for (auto& k : m_vKeyboards) { for (auto const& k : m_vKeyboards) {
k->repeatInfo(rate, delayMs); k->repeatInfo(rate, delayMs);
} }
} }
SP<CWLSeatResource> CWLSeatProtocol::seatResourceForClient(wl_client* client) { SP<CWLSeatResource> CWLSeatProtocol::seatResourceForClient(wl_client* client) {
for (auto& r : m_vSeatResources) { for (auto const& r : m_vSeatResources) {
if (r->client() == client) if (r->client() == client)
return r; 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? // 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); 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, 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()) if (std::find(supportedShmFourccFormats.begin(), supportedShmFourccFormats.end(), fmt.drmFormat) == supportedShmFourccFormats.end())
continue; continue;

View file

@ -22,7 +22,7 @@ CWLSubsurfaceResource::CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWL
return; return;
auto pushAboveIndex = [this](int idx) -> void { auto pushAboveIndex = [this](int idx) -> void {
for (auto& c : parent->subsurfaces) { for (auto const& c : parent->subsurfaces) {
if (c->zIndex >= idx) if (c->zIndex >= idx)
c->zIndex++; c->zIndex++;
} }
@ -53,7 +53,7 @@ CWLSubsurfaceResource::CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWL
return; return;
auto pushBelowIndex = [this](int idx) -> void { auto pushBelowIndex = [this](int idx) -> void {
for (auto& c : parent->subsurfaces) { for (auto const& c : parent->subsurfaces) {
if (c->zIndex <= idx) if (c->zIndex <= idx)
c->zIndex--; c->zIndex--;
} }

View file

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

View file

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

View file

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

View file

@ -118,7 +118,7 @@ void CHyprBorderDecoration::damageEntire() {
CRegion borderRegion(surfaceBoxExpandedBorder); CRegion borderRegion(surfaceBoxExpandedBorder);
borderRegion.subtract(surfaceBoxShrunkRounding); 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())) { if (!g_pHyprRenderer->shouldRenderWindow(m_pWindow.lock(), m.get())) {
const CRegion monitorRegion({m->vecPosition, m->vecSize}); const CRegion monitorRegion({m->vecPosition, m->vecSize});
borderRegion.subtract(monitorRegion); borderRegion.subtract(monitorRegion);

View file

@ -66,7 +66,7 @@ void CHyprDropShadowDecoration::damageEntire() {
shadowRegion.subtract(CRegion(surfaceBox)); 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())) { if (!g_pHyprRenderer->shouldRenderWindow(PWINDOW, m.get())) {
const CRegion monitorRegion({m->vecPosition, m->vecSize}); const CRegion monitorRegion({m->vecPosition, m->vecSize});
shadowRegion.subtract(monitorRegion); shadowRegion.subtract(monitorRegion);

View file

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

View file

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

View file

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