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/xwayland/XWM.cpp | |
| parent | 9bf1b491440eac6f9c0d6853013ad5666c12d1d9 (diff) | |
refactor: use std::ranges whenever possible (#10584)
Diffstat (limited to 'src/xwayland/XWM.cpp')
| -rw-r--r-- | src/xwayland/XWM.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp index 8e4f9a87..76ae1d88 100644 --- a/src/xwayland/XWM.cpp +++ b/src/xwayland/XWM.cpp @@ -164,7 +164,7 @@ static bool lookupParentExists(SP<CXWaylandSurface> XSURF, SP<CXWaylandSurface> XSURF = XSURF->m_parent.lock(); - if (std::find(visited.begin(), visited.end(), XSURF) != visited.end()) + if (std::ranges::find(visited, XSURF) != visited.end()) return false; } @@ -202,7 +202,7 @@ void CXWM::readProp(SP<CXWaylandSurface> XSURF, uint32_t atom, xcb_get_property_ size_t len = xcb_get_property_value_length(reply); char* string = (char*)xcb_get_property_value(reply); XSURF->m_state.appid = std::string{string, len}; - if (std::count(XSURF->m_state.appid.begin(), XSURF->m_state.appid.end(), '\000') == 2) + if (std::ranges::count(XSURF->m_state.appid, '\000') == 2) XSURF->m_state.appid = XSURF->m_state.appid.substr(XSURF->m_state.appid.find_first_of('\000') + 1); // fuck you X if (!XSURF->m_state.appid.empty()) XSURF->m_state.appid.pop_back(); @@ -1109,7 +1109,7 @@ void CXWM::associate(SP<CXWaylandSurface> surf, SP<CWLSurfaceResource> wlSurf) { if (surf->m_surface) return; - auto existing = std::find_if(m_surfaces.begin(), m_surfaces.end(), [wlSurf](const auto& e) { return e->m_surface == wlSurf; }); + auto existing = std::ranges::find_if(m_surfaces, [wlSurf](const auto& e) { return e->m_surface == wlSurf; }); if (existing != m_surfaces.end()) { Debug::log(WARN, "[xwm] associate() called but surface is already associated to {:x}, ignoring...", (uintptr_t)surf.get()); @@ -1420,7 +1420,7 @@ bool SXSelection::sendData(xcb_selection_request_event_t* e, std::string mime) { if (MIMES.empty()) return false; - if (std::find(MIMES.begin(), MIMES.end(), mime) == MIMES.end()) { + if (std::ranges::find(MIMES, mime) == MIMES.end()) { Debug::log(ERR, "[xwm] X Client asked for an invalid MIME, sending the first advertised. THIS SHIT MAY BREAK!"); mime = *MIMES.begin(); } |
