mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-10 17:51:53 -07:00
@@ -451,15 +451,21 @@ PHLWINDOW CWindow::X11TransientFor() {
|
|||||||
if (!m_pXWaylandSurface || !m_pXWaylandSurface->parent)
|
if (!m_pXWaylandSurface || !m_pXWaylandSurface->parent)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto s = m_pXWaylandSurface->parent;
|
auto s = m_pXWaylandSurface->parent;
|
||||||
auto oldParent = s;
|
std::vector<SP<CXWaylandSurface>> visited;
|
||||||
while (s) {
|
while (s) {
|
||||||
// break cyclic loop of m_pXWaylandSurface being parent of itself, #TODO reject this from even being created?
|
// break loops. Some X apps make them, and it seems like it's valid behavior?!?!?!
|
||||||
if (!s->parent || s->parent == oldParent)
|
// TODO: we should reject loops being created in the first place.
|
||||||
|
if (std::find(visited.begin(), visited.end(), s) != visited.end())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
visited.emplace_back(s.lock());
|
||||||
s = s->parent;
|
s = s->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s == m_pXWaylandSurface)
|
||||||
|
return nullptr; // dead-ass circle
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_pXWaylandSurface != s)
|
if (w->m_pXWaylandSurface != s)
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user