From 0831537efab49b3f8508ae7c8b7c581180746ec1 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 12 Feb 2014 15:08:31 +0000 Subject: [PATCH] Tiling2: When adding clients, add them relative to the current one. This fixes clients to be added relative to the current one, and not at the end of the current children list. This fixes T944. --- src/modules/tiling/window_tree.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/tiling/window_tree.c b/src/modules/tiling/window_tree.c index ddabe0bed..d43d1aebf 100644 --- a/src/modules/tiling/window_tree.c +++ b/src/modules/tiling/window_tree.c @@ -45,7 +45,7 @@ _tiling_window_tree_split_add(Window_Tree *parent, Window_Tree *new_node) } static void -_tiling_window_tree_parent_add(Window_Tree *parent, Window_Tree *new_node) +_tiling_window_tree_parent_add(Window_Tree *parent, Window_Tree *new_node, Window_Tree *rel) { /* Adjust existing children's weights */ Window_Tree *itr; @@ -62,7 +62,8 @@ _tiling_window_tree_parent_add(Window_Tree *parent, Window_Tree *new_node) } parent->children = - eina_inlist_append(parent->children, EINA_INLIST_GET(new_node)); + eina_inlist_append_relative(parent->children, EINA_INLIST_GET(new_node), + EINA_INLIST_GET(rel)); } static int @@ -83,6 +84,7 @@ 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 = calloc(1, sizeof(*new_node)); new_node->client = client; @@ -113,7 +115,7 @@ tiling_window_tree_add(Window_Tree *root, Window_Tree *parent, { if (parent->children) { - _tiling_window_tree_parent_add(parent, new_node); + _tiling_window_tree_parent_add(parent, new_node, NULL); } else { @@ -126,7 +128,7 @@ tiling_window_tree_add(Window_Tree *root, Window_Tree *parent, if (grand_parent && grand_parent->children) { - _tiling_window_tree_parent_add(grand_parent, new_node); + _tiling_window_tree_parent_add(grand_parent, new_node, orig_parent); } else {