Tiling2: Changed add to return new root and fixed top-level vertical.
authorTom Hacohen <tom@stosb.com>
Tue, 14 Jan 2014 14:29:29 +0000 (14:29 +0000)
committerTom Hacohen <tom@stosb.com>
Fri, 21 Feb 2014 09:15:06 +0000 (09:15 +0000)
src/modules/tiling/e_mod_tiling.c
src/modules/tiling/window_tree.c

index e3d259e..7642b32 100644 (file)
@@ -482,7 +482,6 @@ _add_client(E_Client *ec)
          /* If focused is NULL, it should return the root. */
          Window_Tree *parent = tiling_window_tree_client_find(_G.tinfo->tree,
                ec_focused);
-         Window_Tree *new_node;
          if (!parent)
            {
               if (_G.tinfo->tree && ec_focused)
@@ -493,9 +492,7 @@ _add_client(E_Client *ec)
               parent = _G.tinfo->tree;
            }
 
-         new_node = tiling_window_tree_add(_G.tinfo->tree, parent, ec, _G.split_type);
-         if (!_G.tinfo->tree)
-            _G.tinfo->tree = new_node;
+         _G.tinfo->tree = tiling_window_tree_add(_G.tinfo->tree, parent, ec, _G.split_type);
       }
 
     _reapply_tree();
index 69cb377..b722b67 100644 (file)
@@ -114,12 +114,16 @@ tiling_window_tree_add(Window_Tree *root, Window_Tree *parent, E_Client *client,
           }
         else
           {
-             /* FIXME: This is wrong. */
+             root = calloc(1, sizeof(*root));
              _tiling_window_tree_split_add(parent, new_node);
+             root->weight = 1.0;
+             root->children = eina_inlist_append(root->children,
+                   EINA_INLIST_GET(parent));
+             parent->parent = root;
           }
      }
 
-   return new_node;
+   return root;
 }
 
 Window_Tree *