From 5da114477fdb1c806f5ad6f6fbb22903481f24c1 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 28 Aug 2022 19:47:06 +0200 Subject: move X11 transients to top on parent top --- src/Compositor.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 790ef592..5c9451a8 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -904,11 +904,34 @@ void CCompositor::moveWindowToTop(CWindow* pWindow) { if (!windowValidMapped(pWindow)) return; - for (auto it = m_vWindows.begin(); it != m_vWindows.end(); ++it) { - if (it->get() == pWindow) { - std::rotate(it, it + 1, m_vWindows.end()); - break; + auto moveToTop = [&](CWindow* pw) -> void { + for (auto it = m_vWindows.begin(); it != m_vWindows.end(); ++it) { + if (it->get() == pw) { + std::rotate(it, it + 1, m_vWindows.end()); + break; + } } + }; + + moveToTop(pWindow); + + if (!pWindow->m_bIsX11) + return; + + // move all children + + std::deque toMove; + + for (auto& w : m_vWindows) { + if (w->m_bIsMapped && w->m_bMappedX11 && !w->m_bHidden && w->m_bIsX11 && w->X11TransientFor() == pWindow) { + toMove.emplace_back(w.get()); + } + } + + for (auto& pw : toMove) { + moveToTop(pw); + + moveWindowToTop(pw); } } -- cgit v1.2.3