fix wm_treenode_remove_client

This commit is contained in:
Akos Horvath 2023-12-29 20:34:04 +01:00
parent 70d06f7888
commit 3742a49f32

View File

@ -518,8 +518,14 @@ TreeNode* wm_treenode_remove_client(Wm *wm, TreeNode *root, Client *client)
if (node->parent == NULL) {
// parent is root node
DEBUG_PRINT("parent is root node!\n");
TreeNode old_root = *client->ws->tree;
sibling_node->parent = NULL;
client->ws->tree = sibling_node;
*client->ws->tree = *sibling_node;
wm_nodearray_free(old_root.children);
free(sibling_node);
client->ws->tree->pos = (Rect) {
.x = wm->config.border_width, .y = wm->config.border_width + dock_y ,
@ -528,6 +534,9 @@ TreeNode* wm_treenode_remove_client(Wm *wm, TreeNode *root, Client *client)
};
assert(client->ws->tree->children->size == 2);
client->ws->tree->children->nodes[0]->parent = client->ws->tree;
client->ws->tree->children->nodes[1]->parent = client->ws->tree;
wm_treenode_split_space(client->ws->tree, &client->ws->tree->children->nodes[0]->pos,
&client->ws->tree->children->nodes[1]->pos);
} else {