Skip to content

Commit

Permalink
compositor: minor cleanups for fading out layers
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Aug 7, 2024
1 parent 2e3dc17 commit f36c625
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1425,12 +1425,16 @@ void CCompositor::cleanupFadingOut(const int& monid) {
}
}

bool layersDirty = false;

for (auto& lsr : m_vSurfacesFadingOut) {

auto ls = lsr.lock();

if (!ls)
if (!ls) {
layersDirty = true;
continue;
}

if (ls->monitorID != monid)
continue;
Expand All @@ -1443,7 +1447,7 @@ void CCompositor::cleanupFadingOut(const int& monid) {
for (auto& m : m_vMonitors) {
for (auto& lsl : m->m_aLayerSurfaceLayers) {
if (!lsl.empty() && std::find_if(lsl.begin(), lsl.end(), [&](auto& other) { return other == ls; }) != lsl.end()) {
std::erase_if(lsl, [&](auto& other) { return other == ls; });
std::erase_if(lsl, [&](auto& other) { return other == ls || !other; });
}
}
}
Expand All @@ -1459,6 +1463,9 @@ void CCompositor::cleanupFadingOut(const int& monid) {
return;
}
}

if (layersDirty)
std::erase_if(m_vSurfacesFadingOut, [](const auto& el) { return el.expired(); });
}

void CCompositor::addToFadingOutSafe(PHLLS pLS) {
Expand Down

0 comments on commit f36c625

Please sign in to comment.