mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-16 03:03:40 +01:00
Fix segfault when shifting a window out of the root node
This commit is contained in:
parent
003e63f200
commit
f4f72dc961
1 changed files with 9 additions and 4 deletions
|
@ -1442,10 +1442,15 @@ void Hy3Layout::shiftWindow(int workspace, ShiftDirection direction, bool once)
|
||||||
if (node == nullptr) return;
|
if (node == nullptr) return;
|
||||||
|
|
||||||
if (once && node->parent != nullptr && node->parent->data.as_group.children.size() == 1) {
|
if (once && node->parent != nullptr && node->parent->data.as_group.children.size() == 1) {
|
||||||
auto* node2 = node->parent;
|
if (node->parent->parent == nullptr) {
|
||||||
Hy3Node::swapData(*node, *node2);
|
node->parent->data.as_group.layout = Hy3GroupLayout::SplitH;
|
||||||
node2->layout->nodes.remove(*node);
|
node->parent->recalcSizePosRecursive();
|
||||||
node2->recalcSizePosRecursive();
|
} else {
|
||||||
|
auto* node2 = node->parent;
|
||||||
|
Hy3Node::swapData(*node, *node2);
|
||||||
|
node2->layout->nodes.remove(*node);
|
||||||
|
node2->recalcSizePosRecursive();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this->shiftOrGetFocus(*node, direction, true, once, false);
|
this->shiftOrGetFocus(*node, direction, true, once, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue