From 21418f97ff31d68276b1b2b228d5b1fea26cf01d Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 21 Mar 2022 16:33:38 +0100 Subject: [PATCH] fixed closing layers not recalcing layout --- README.md | 1 - src/events/Layers.cpp | 13 +++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 12c52d5f..3e05fef6 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ Nevertheless, REPORT any you find! Make an issue! - Window rules - Drag and drop - Fix electron rendering issues - - Fix closing layers not recalcing layout - Fix sloppy dragging of windows - Optimization - IPC done correctly with a socket diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp index d6e83073..141aad56 100644 --- a/src/events/Layers.cpp +++ b/src/events/Layers.cpp @@ -57,7 +57,7 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) { SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_destroyLayerSurface); if (layersurface->layerSurface->mapped) - layersurface->layerSurface->mapped = 0; + layersurface->layerSurface->mapped = false; if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus) g_pCompositor->m_pLastFocus = nullptr; @@ -73,12 +73,21 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) { PMONITOR->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface); delete layersurface; + // rearrange to fix the reserved areas + if (PMONITOR) { + g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID); + g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID); + } + + Debug::log(LOG, "LayerSurface %x destroyed", layersurface); } void Events::listener_mapLayerSurface(wl_listener* listener, void* data) { SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_mapLayerSurface); + layersurface->layerSurface->mapped = true; + wlr_surface_send_enter(layersurface->layerSurface->surface, layersurface->layerSurface->output); // fix if it changed its mon @@ -105,7 +114,7 @@ void Events::listener_unmapLayerSurface(wl_listener* listener, void* data) { SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_unmapLayerSurface); if (layersurface->layerSurface->mapped) - layersurface->layerSurface->mapped = 0; + layersurface->layerSurface->mapped = false; if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus) g_pCompositor->m_pLastFocus = nullptr;