tiling: only use the insert function

this brings all possible bugs due to insertion to one single function
This commit is contained in:
Marcel Hollerbach 2017-08-12 17:24:26 +02:00
parent 1e2fa5649e
commit f1fb4a0c83
3 changed files with 2 additions and 58 deletions

View File

@ -703,7 +703,7 @@ _insert_client_prefered(E_Client *ec)
}
else
{
_G.tinfo->tree = tiling_window_tree_add(_G.tinfo->tree, NULL, ec, _current_tiled_state(EINA_FALSE));
_G.tinfo->tree = tiling_window_tree_insert(_G.tinfo->tree, _G.tinfo->tree, ec, _current_tiled_state(EINA_FALSE), EINA_FALSE);
}
}
@ -722,7 +722,7 @@ _insert_client(E_Client *ec, Tiling_Split_Type type)
//otherwise place next to the given client
place = tiling_window_tree_client_find(_G.tinfo->tree,
ec_focused);
_G.tinfo->tree = tiling_window_tree_add(_G.tinfo->tree, place, ec, type);
_G.tinfo->tree = tiling_window_tree_insert(_G.tinfo->tree, place, ec, type, EINA_FALSE);
}

View File

@ -142,59 +142,6 @@ tiling_window_tree_insert(Window_Tree *root, Window_Tree *buddy,
return root;
}
Window_Tree *
tiling_window_tree_add(Window_Tree *root, Window_Tree *parent,
E_Client *client, Tiling_Split_Type split_type)
{
Window_Tree *orig_parent = parent;
Window_Tree *new_node;
Tiling_Split_Type parent_split_type;
VERIFY_TYPE(split_type)
new_node = calloc(1, sizeof(*new_node));
new_node->client = client;
ROOT_CHECK()
if (!parent)
parent = root;
parent_split_type = _tiling_window_tree_split_type_get(parent);
if (parent_split_type == split_type)
{
if (parent->children)
{
_tiling_window_tree_parent_add(parent, new_node, NULL, EINA_TRUE);
}
else
{
_tiling_window_tree_split_add(parent, new_node, EINA_TRUE);
}
}
else
{
Window_Tree *grand_parent = parent->parent;
if (grand_parent && grand_parent->children)
{
_tiling_window_tree_parent_add(grand_parent, new_node, orig_parent, EINA_TRUE);
}
else
{
root = calloc(1, sizeof(*root));
_tiling_window_tree_split_add(parent, new_node, EINA_TRUE);
root->weight = 1.0;
root->children =
eina_inlist_append(root->children, EINA_INLIST_GET(parent));
parent->parent = root;
}
}
return root;
}
static Window_Tree *
tiling_window_tree_unref(Window_Tree *root, Window_Tree *item)
{

View File

@ -34,9 +34,6 @@ int tiling_window_tree_edges_get(Window_Tree *node);
void tiling_window_tree_free(Window_Tree *root);
void tiling_window_tree_walk(Window_Tree *root, void (*func)(void *));
Window_Tree *tiling_window_tree_add(Window_Tree *root, Window_Tree *parent,
E_Client *client, Tiling_Split_Type split_type);
Window_Tree *tiling_window_tree_insert(Window_Tree *root, Window_Tree *buddy,
E_Client *client, Tiling_Split_Type split_type, Eina_Bool before);