mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 19:25:59 +01:00
simplify dwindle swap
This commit is contained in:
parent
8e0f7b9b11
commit
9f82278d65
1 changed files with 3 additions and 38 deletions
|
@ -1012,44 +1012,9 @@ void CHyprDwindleLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we will not delete the nodes, just fix the tree
|
// swap the windows and recalc
|
||||||
if (PNODE2->pParent == PNODE->pParent) {
|
PNODE2->pWindow = pWindow;
|
||||||
const auto PPARENT = PNODE->pParent;
|
PNODE->pWindow = pWindow2;
|
||||||
|
|
||||||
if (PPARENT->children[0] == PNODE) {
|
|
||||||
PPARENT->children[0] = PNODE2;
|
|
||||||
PPARENT->children[1] = PNODE;
|
|
||||||
} else {
|
|
||||||
PPARENT->children[0] = PNODE;
|
|
||||||
PPARENT->children[1] = PNODE2;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (PNODE->pParent) {
|
|
||||||
const auto PPARENT = PNODE->pParent;
|
|
||||||
|
|
||||||
if (PPARENT->children[0] == PNODE) {
|
|
||||||
PPARENT->children[0] = PNODE2;
|
|
||||||
} else {
|
|
||||||
PPARENT->children[1] = PNODE2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PNODE2->pParent) {
|
|
||||||
const auto PPARENT = PNODE2->pParent;
|
|
||||||
|
|
||||||
if (PPARENT->children[0] == PNODE2) {
|
|
||||||
PPARENT->children[0] = PNODE;
|
|
||||||
} else {
|
|
||||||
PPARENT->children[1] = PNODE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto PPARENTNODE2 = PNODE2->pParent;
|
|
||||||
PNODE2->pParent = PNODE->pParent;
|
|
||||||
PNODE->pParent = PPARENTNODE2;
|
|
||||||
|
|
||||||
// these are window nodes, so no children.
|
|
||||||
|
|
||||||
// recalc the workspace
|
// recalc the workspace
|
||||||
getMasterNodeOnWorkspace(PNODE->workspaceID)->recalcSizePosRecursive();
|
getMasterNodeOnWorkspace(PNODE->workspaceID)->recalcSizePosRecursive();
|
||||||
|
|
Loading…
Reference in a new issue