diff options
Diffstat (limited to 'src/Compositor.cpp')
| -rw-r--r-- | src/Compositor.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 99a46dfa..d8c39e30 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -716,7 +716,7 @@ CWindow* CCompositor::getWindowForPopup(wlr_xdg_popup* popup) { return nullptr; } -wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::list<SLayerSurface*>* layerSurfaces, Vector2D* sCoords, SLayerSurface** ppLayerSurfaceFound) { +wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<std::unique_ptr<SLayerSurface>>* layerSurfaces, Vector2D* sCoords, SLayerSurface** ppLayerSurfaceFound) { for (auto it = layerSurfaces->rbegin(); it != layerSurfaces->rend(); it++) { if ((*it)->fadingOut || !(*it)->layerSurface || ((*it)->layerSurface && !(*it)->layerSurface->mapped)) continue; @@ -724,7 +724,7 @@ wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::list<SL const auto SURFACEAT = wlr_layer_surface_v1_surface_at((*it)->layerSurface, pos.x - (*it)->geometry.x, pos.y - (*it)->geometry.y, &sCoords->x, &sCoords->y); if (SURFACEAT) { - *ppLayerSurfaceFound = *it; + *ppLayerSurfaceFound = it->get(); return SURFACEAT; } } @@ -900,18 +900,18 @@ void CCompositor::cleanupFadingOut(const int& monid) { continue; if (ls->fadingOut && ls->readyToDelete && !ls->alpha.isBeingAnimated()) { - for (auto& m : m_vMonitors) { - for (auto& lsl : m->m_aLayerSurfaceLists) { - lsl.remove(ls); - } - } - g_pHyprOpenGL->m_mLayerFramebuffers[ls].release(); g_pHyprOpenGL->m_mLayerFramebuffers.erase(ls); - delete ls; m_vSurfacesFadingOut.erase(std::remove(m_vSurfacesFadingOut.begin(), m_vSurfacesFadingOut.end(), ls)); + for (auto& m : m_vMonitors) { + for (auto& lsl : m->m_aLayerSurfaceLists) { + if (!lsl.empty() && std::find_if(lsl.begin(), lsl.end(), [&](std::unique_ptr<SLayerSurface>& other) { return other.get() == ls; }) != lsl.end()) + lsl.erase(std::remove_if(lsl.begin(), lsl.end(), [&](std::unique_ptr<SLayerSurface>& other) { return other.get() == ls; })); + } + } + Debug::log(LOG, "Cleanup: destroyed a layersurface"); glFlush(); // to free mem NOW. |
