From 366ebc123bc17165a599f44768c7338d166124ae Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 6 Apr 2023 20:59:44 +0100 Subject: [PATCH] internal: don't remove x11 children on parent remove --- src/Compositor.cpp | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 08ad2268..14fd0c98 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -525,21 +525,8 @@ CMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) { } void CCompositor::removeWindowFromVectorSafe(CWindow* pWindow) { - if (windowExists(pWindow) && !pWindow->m_bFadingOut) { - // if X11, also check its children - // and delete any needed - if (pWindow->m_bIsX11) { - for (auto& w : m_vWindows) { - if (!w->m_bIsX11) - continue; - - if (w->m_pX11Parent == pWindow) - std::erase_if(m_vWindows, [&](std::unique_ptr& el) { return el.get() == w.get(); }); - } - } - + if (windowExists(pWindow) && !pWindow->m_bFadingOut) std::erase_if(m_vWindows, [&](std::unique_ptr& el) { return el.get() == pWindow; }); - } } bool CCompositor::windowExists(CWindow* pWindow) { @@ -557,13 +544,15 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) { if (PMONITOR->specialWorkspaceID) { for (auto& w : m_vWindows | std::views::reverse) { wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; - if (w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->isHidden() && !w->m_bNoFocus) + if (w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->isHidden() && + !w->m_bNoFocus) return w.get(); } for (auto& w : m_vWindows) { wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; - if (w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && !w->m_bIsFloating && !w->isHidden() && !w->m_bNoFocus) + if (w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && !w->m_bIsFloating && !w->isHidden() && + !w->m_bNoFocus) return w.get(); } } @@ -578,7 +567,8 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) { // first loop over floating cuz they're above, m_vWindows should be sorted bottom->top, for tiled it doesn't matter. for (auto& w : m_vWindows | std::views::reverse) { wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; - if (wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && !w->m_bPinned && !w->m_bNoFocus) + if (wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && !w->m_bPinned && + !w->m_bNoFocus) return w.get(); } @@ -723,7 +713,8 @@ CWindow* CCompositor::windowFromCursor() { // first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter. for (auto& w : m_vWindows | std::views::reverse) { wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; - if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->m_bPinned && !w->m_bNoFocus) + if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->m_bPinned && + !w->m_bNoFocus) return w.get(); }