mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-30 01:25:59 +01:00
move X11 transients to top on parent top
This commit is contained in:
parent
c757fa54e1
commit
5da114477f
3 changed files with 45 additions and 5 deletions
|
@ -904,11 +904,34 @@ void CCompositor::moveWindowToTop(CWindow* pWindow) {
|
||||||
if (!windowValidMapped(pWindow))
|
if (!windowValidMapped(pWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto it = m_vWindows.begin(); it != m_vWindows.end(); ++it) {
|
auto moveToTop = [&](CWindow* pw) -> void {
|
||||||
if (it->get() == pWindow) {
|
for (auto it = m_vWindows.begin(); it != m_vWindows.end(); ++it) {
|
||||||
std::rotate(it, it + 1, m_vWindows.end());
|
if (it->get() == pw) {
|
||||||
break;
|
std::rotate(it, it + 1, m_vWindows.end());
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
moveToTop(pWindow);
|
||||||
|
|
||||||
|
if (!pWindow->m_bIsX11)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// move all children
|
||||||
|
|
||||||
|
std::deque<CWindow*> 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,3 +217,19 @@ void CWindow::moveToWorkspace(int workspaceID) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CWindow* CWindow::X11TransientFor() {
|
||||||
|
if (!m_bIsX11)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (!m_uSurface.xwayland->parent)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto PPARENT = g_pCompositor->getWindowFromSurface(m_uSurface.xwayland->parent->surface);
|
||||||
|
|
||||||
|
while (PPARENT->m_uSurface.xwayland->parent) {
|
||||||
|
PPARENT = g_pCompositor->getWindowFromSurface(PPARENT->m_uSurface.xwayland->parent->surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PPARENT;
|
||||||
|
}
|
||||||
|
|
|
@ -159,4 +159,5 @@ public:
|
||||||
void updateToplevel();
|
void updateToplevel();
|
||||||
void updateSurfaceOutputs();
|
void updateSurfaceOutputs();
|
||||||
void moveToWorkspace(int);
|
void moveToWorkspace(int);
|
||||||
|
CWindow* X11TransientFor();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue