From 0c5afecfc94f6e7e93f6f8bded79b26f46cc80aa Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Tue, 14 Jan 2014 14:03:18 +0000 Subject: [PATCH] Tiling2: More bug fixing. --- src/modules/tiling/window_tree.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/modules/tiling/window_tree.c b/src/modules/tiling/window_tree.c index e58a510c2..29beffc9c 100644 --- a/src/modules/tiling/window_tree.c +++ b/src/modules/tiling/window_tree.c @@ -137,11 +137,11 @@ tiling_window_tree_remove(Window_Tree *root, Window_Tree *item) } + Window_Tree *parent = item->parent; int children_count = eina_inlist_count(item->parent->children); if (children_count <= 2) { - Window_Tree *parent = item->parent; Window_Tree *grand_parent = parent->parent; Window_Tree *item_keep = NULL; /* Adjust existing children's weights */ @@ -180,28 +180,27 @@ tiling_window_tree_remove(Window_Tree *root, Window_Tree *item) } else { - /* FIXME: Toggle root tree direction. */ - item_keep->parent = NULL; - root = item_keep; - goto end; + /* This is fine, as this is a child of the root so we allow two + * levels. */ } + + parent->children = eina_inlist_remove(parent->children, EINA_INLIST_GET(item)); } else { Window_Tree *itr; float weight = 1.0 - item->weight; - item->parent->children = eina_inlist_remove(item->parent->children, + parent->children = eina_inlist_remove(parent->children, EINA_INLIST_GET(item)); /* Adjust existing children's weights */ - EINA_INLIST_FOREACH(item->parent->children, itr) + EINA_INLIST_FOREACH(parent->children, itr) { itr->weight /= weight; } } -end: free(item); return root; }