From f8eb4c46bf53b88f7dd36a6130100d283001ec6c Mon Sep 17 00:00:00 2001 From: Robert Paciorek Date: Tue, 9 Jun 2026 13:01:18 +0000 Subject: [PATCH] fix not remove views from workspace preview issues * fixed not removing closed or minimalised window * loop and line `WayfireWorkspaceWindow *w = (WayfireWorkspaceWindow*)widget;` caused removing fist processed overlay instead of related to a closed window * fixed not removing closed window on not current workspace * `windows` was cleared in `clear_box` but `overlay` child was not removed which led to overlays being duplicated when switching workspaces --- src/panel/widgets/workspace-switcher.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/panel/widgets/workspace-switcher.cpp b/src/panel/widgets/workspace-switcher.cpp index 822f1c00..be4034dc 100644 --- a/src/panel/widgets/workspace-switcher.cpp +++ b/src/panel/widgets/workspace-switcher.cpp @@ -134,6 +134,11 @@ void WayfireWorkspaceSwitcher::clear_box() box.remove(*child); } + for (auto child : overlay.get_children()) + { + overlay.remove_overlay(*child); + } + for (auto child : mini_grid.get_children()) { mini_grid.remove(*child); @@ -723,14 +728,10 @@ void WayfireWorkspaceSwitcher::grid_remove_view(wf::json_t view_data) { if (w->id == view_data["id"].as_int()) { - for (auto widget : overlay.get_children()) - { - WayfireWorkspaceWindow *w = (WayfireWorkspaceWindow*)widget; - overlay.remove_overlay(*w); - auto elem = std::remove(windows.begin(), windows.end(), w); - windows.erase(elem, windows.end()); - return; - } + overlay.remove_overlay(*w); + auto elem = std::remove(windows.begin(), windows.end(), w); + windows.erase(elem, windows.end()); + return; } } }