mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 04:09:49 +01:00
internal: don't remove x11 children on parent remove
This commit is contained in:
parent
bc4a51dbbb
commit
366ebc123b
1 changed files with 9 additions and 18 deletions
|
@ -525,22 +525,9 @@ CMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::removeWindowFromVectorSafe(CWindow* pWindow) {
|
void CCompositor::removeWindowFromVectorSafe(CWindow* pWindow) {
|
||||||
if (windowExists(pWindow) && !pWindow->m_bFadingOut) {
|
if (windowExists(pWindow) && !pWindow->m_bFadingOut)
|
||||||
// if X11, also check its children
|
|
||||||
// and delete any needed
|
|
||||||
if (pWindow->m_bIsX11) {
|
|
||||||
for (auto& w : m_vWindows) {
|
|
||||||
if (!w->m_bIsX11)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (w->m_pX11Parent == pWindow)
|
|
||||||
std::erase_if(m_vWindows, [&](std::unique_ptr<CWindow>& el) { return el.get() == w.get(); });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::erase_if(m_vWindows, [&](std::unique_ptr<CWindow>& el) { return el.get() == pWindow; });
|
std::erase_if(m_vWindows, [&](std::unique_ptr<CWindow>& el) { return el.get() == pWindow; });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool CCompositor::windowExists(CWindow* pWindow) {
|
bool CCompositor::windowExists(CWindow* pWindow) {
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
|
@ -557,13 +544,15 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
|
||||||
if (PMONITOR->specialWorkspaceID) {
|
if (PMONITOR->specialWorkspaceID) {
|
||||||
for (auto& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
|
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
|
||||||
if (w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->isHidden() && !w->m_bNoFocus)
|
if (w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->isHidden() &&
|
||||||
|
!w->m_bNoFocus)
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
|
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
|
||||||
if (w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && !w->m_bIsFloating && !w->isHidden() && !w->m_bNoFocus)
|
if (w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && !w->m_bIsFloating && !w->isHidden() &&
|
||||||
|
!w->m_bNoFocus)
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -578,7 +567,8 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
|
||||||
// first loop over floating cuz they're above, m_vWindows should be sorted bottom->top, for tiled it doesn't matter.
|
// first loop over floating cuz they're above, m_vWindows should be sorted bottom->top, for tiled it doesn't matter.
|
||||||
for (auto& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
|
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
|
||||||
if (wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && !w->m_bPinned && !w->m_bNoFocus)
|
if (wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && !w->m_bPinned &&
|
||||||
|
!w->m_bNoFocus)
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,7 +713,8 @@ CWindow* CCompositor::windowFromCursor() {
|
||||||
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
|
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
|
||||||
for (auto& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
|
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
|
||||||
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->m_bPinned && !w->m_bNoFocus)
|
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->m_bPinned &&
|
||||||
|
!w->m_bNoFocus)
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue