diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-05-08 21:00:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-08 21:00:28 +0200 |
| commit | 04c98abd1fe7f3d63c6060ea175e0a5cd9cd9947 (patch) | |
| tree | ff9019b3b563659a130d211ae33c11f6a248b79e /src/desktop/Window.cpp | |
| parent | 53bfb92d6539e63e65f63965eca12fa33597764a (diff) | |
layout: properly assign workspace and monitor when moving a child to the parent (#10338)
Diffstat (limited to 'src/desktop/Window.cpp')
| -rw-r--r-- | src/desktop/Window.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index c712e5eb..c2b92094 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -1822,3 +1822,24 @@ std::optional<std::string> CWindow::xdgDescription() { return m_xdgSurface->m_toplevel->m_toplevelDescription; } + +PHLWINDOW CWindow::parent() { + if (m_isX11) { + auto t = x11TransientFor(); + + // don't return a parent that's not mapped + if (!validMapped(t)) + return nullptr; + + return t; + } + + if (!m_xdgSurface || !m_xdgSurface->m_toplevel || !m_xdgSurface->m_toplevel->m_parent) + return nullptr; + + // don't return a parent that's not mapped + if (!m_xdgSurface->m_toplevel->m_parent->m_window || !validMapped(m_xdgSurface->m_toplevel->m_parent->m_window)) + return nullptr; + + return m_xdgSurface->m_toplevel->m_parent->m_window.lock(); +} |
