diff options
| author | Kamikadze <40305144+Kam1k4dze@users.noreply.github.com> | 2025-05-30 18:25:59 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-30 14:25:59 +0100 |
| commit | 9190443d951c21ab24201d033accf90b4d172f46 (patch) | |
| tree | 28a5e4a1fa9c7424733ac7065a71cead7e141b6f /src/managers/input/InputManager.cpp | |
| parent | 9bf1b491440eac6f9c0d6853013ad5666c12d1d9 (diff) | |
refactor: use std::ranges whenever possible (#10584)
Diffstat (limited to 'src/managers/input/InputManager.cpp')
| -rw-r--r-- | src/managers/input/InputManager.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 2d50dbcf..cc0485d8 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -619,7 +619,7 @@ void CInputManager::onMouseButton(IPointer::SButtonEvent e) { if (e.state == WL_POINTER_BUTTON_STATE_PRESSED) { m_currentlyHeldButtons.push_back(e.button); } else { - if (std::find_if(m_currentlyHeldButtons.begin(), m_currentlyHeldButtons.end(), [&](const auto& other) { return other == e.button; }) == m_currentlyHeldButtons.end()) + if (std::ranges::find_if(m_currentlyHeldButtons, [&](const auto& other) { return other == e.button; }) == m_currentlyHeldButtons.end()) return; std::erase_if(m_currentlyHeldButtons, [&](const auto& other) { return other == e.button; }); } @@ -1552,7 +1552,7 @@ void CInputManager::unconstrainMouse() { } bool CInputManager::isConstrained() { - return std::any_of(m_constraints.begin(), m_constraints.end(), [](auto const& c) { + return std::ranges::any_of(m_constraints, [](auto const& c) { const auto constraint = c.lock(); return constraint && constraint->isActive() && constraint->owner()->resource() == g_pCompositor->m_lastFocus; }); @@ -1773,9 +1773,9 @@ void CInputManager::unsetCursorImage() { } std::string CInputManager::deviceNameToInternalString(std::string in) { - std::replace(in.begin(), in.end(), ' ', '-'); - std::replace(in.begin(), in.end(), '\n', '-'); - std::transform(in.begin(), in.end(), in.begin(), ::tolower); + std::ranges::replace(in, ' ', '-'); + std::ranges::replace(in, '\n', '-'); + std::ranges::transform(in, in.begin(), ::tolower); return in; } @@ -1786,7 +1786,7 @@ std::string CInputManager::getNameForNewDevice(std::string internalName) { auto makeNewName = [&]() { return (proposedNewName.empty() ? "unknown-device" : proposedNewName) + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }; - while (std::find_if(m_hids.begin(), m_hids.end(), [&](const auto& other) { return other->m_hlName == makeNewName(); }) != m_hids.end()) + while (std::ranges::find_if(m_hids, [&](const auto& other) { return other->m_hlName == makeNewName(); }) != m_hids.end()) dupeno++; return makeNewName(); |
