diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-09-14 17:24:45 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-09-14 17:24:45 +0200 |
| commit | 9f82278d65ab0b0434c14c0dbbd6556a40232f36 (patch) | |
| tree | 8cadb64f0779738244d1d4ddacc197d235c0f518 /src/layout/DwindleLayout.cpp | |
| parent | 8e0f7b9b117b1a40a78261f1dd27d4a9b9cae916 (diff) | |
simplify dwindle swap
Diffstat (limited to 'src/layout/DwindleLayout.cpp')
| -rw-r--r-- | src/layout/DwindleLayout.cpp | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index b6e373ec..2f9b00fa 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -1012,44 +1012,9 @@ void CHyprDwindleLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) { return; } - // we will not delete the nodes, just fix the tree - if (PNODE2->pParent == PNODE->pParent) { - const auto PPARENT = PNODE->pParent; - - 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. + // swap the windows and recalc + PNODE2->pWindow = pWindow; + PNODE->pWindow = pWindow2; // recalc the workspace getMasterNodeOnWorkspace(PNODE->workspaceID)->recalcSizePosRecursive(); |
