diff options
author | Vaxry <[email protected]> | 2024-10-16 22:22:36 +0100 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-10-16 22:23:15 +0100 |
commit | b57086aa4362117c1f1025246f618d760e44b026 (patch) | |
tree | d2510d894cb990d9ccd7d52ed24b87b5332cf085 /src | |
parent | 09581d32fd465c5c4ff868090369ee67516c38a9 (diff) | |
download | Hyprland-b57086aa4362117c1f1025246f618d760e44b026.tar.gz Hyprland-b57086aa4362117c1f1025246f618d760e44b026.zip |
window: properly break cycles in X11TransientFor
ref #8045
Diffstat (limited to 'src')
-rw-r--r-- | src/desktop/Window.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index fa85dc07..a393f361 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -451,15 +451,21 @@ PHLWINDOW CWindow::X11TransientFor() { if (!m_pXWaylandSurface || !m_pXWaylandSurface->parent) return nullptr; - auto s = m_pXWaylandSurface->parent; - auto oldParent = s; + auto s = m_pXWaylandSurface->parent; + std::vector<SP<CXWaylandSurface>> visited; while (s) { - // break cyclic loop of m_pXWaylandSurface being parent of itself, #TODO reject this from even being created? - if (!s->parent || s->parent == oldParent) + // break loops. Some X apps make them, and it seems like it's valid behavior?!?!?! + // TODO: we should reject loops being created in the first place. + if (std::find(visited.begin(), visited.end(), s) != visited.end()) break; + + visited.emplace_back(s.lock()); s = s->parent; } + if (s == m_pXWaylandSurface) + return nullptr; // dead-ass circle + for (auto const& w : g_pCompositor->m_vWindows) { if (w->m_pXWaylandSurface != s) continue; |