summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2014-11-03 14:32:05 +0000
committerTom Hacohen <tom@stosb.com>2014-11-03 14:35:46 +0000
commitca1a531c7829272ba64c43ba03d0754b4ff84638 (patch)
tree293a13533673bab777cdada2369917038e362ced
parent3405362b1d3160b2714cf17561a8d48e5405f7e8 (diff)
downloadenlightenment-ca1a531c7829272ba64c43ba03d0754b4ff84638.tar.gz
tiling: Fix issue with window-moving and windows not breaking out.
Summary: The module is now working like it is described in T1773. What the patch really does: If a join request can not be done cause there is no node in the direction to join, the join will try to break out the node into the grand-grand-parent, this means a node can break out of his parent without walking done each parent. Issue as described in the original ticket: Each number represents a different window: 122 134 155 Focus on 3, press Win+Left I'd expect it to become: 132 134 135 But instead, nothing happens. Fixes T1773 Reviewers: tasn Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1632
-rw-r--r--src/modules/tiling/window_tree.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/modules/tiling/window_tree.c b/src/modules/tiling/window_tree.c
index cd7d9d367d..9816bec81c 100644
--- a/src/modules/tiling/window_tree.c
+++ b/src/modules/tiling/window_tree.c
@@ -545,13 +545,20 @@ tiling_window_tree_edges_get(Window_Tree *node)
* appended or prependet, or joined with the previous child or the next child
*/
void
-_tiling_window_tree_node_break_out(Window_Tree *root, Window_Tree *node, Eina_Bool dir)
+_tiling_window_tree_node_break_out(Window_Tree *root, Window_Tree *node, Window_Tree *par, Eina_Bool dir)
{
- Window_Tree *res, *grand_parent;
+ Window_Tree *res, *ac; /* ac is the child of the root, that is a parent of a node */
+
+ if(!par) return;
+
+ /* search a path from the node to the par */
+ ac = node;
+ while (ac->parent != par)
+ ac = ac->parent;
if (dir)
{
- res = _inlist_next(node->parent);
+ res = _inlist_next(ac);
if (res)
{
dir = EINA_FALSE;
@@ -559,20 +566,16 @@ _tiling_window_tree_node_break_out(Window_Tree *root, Window_Tree *node, Eina_Bo
}
else
{
- res = _inlist_prev(node->parent);
+ res = _inlist_prev(ac);
if (res)
{
dir = EINA_TRUE;
}
}
- grand_parent = node->parent->parent;
- if (!grand_parent)
- return;
-
tiling_window_tree_unref(root, node);
- _tiling_window_tree_parent_add(grand_parent, node, res, dir);
+ _tiling_window_tree_parent_add(par, node, res, dir);
}
void
@@ -586,7 +589,11 @@ _tiling_window_tree_node_join(Window_Tree *root, Window_Tree *node, Eina_Bool di
pn = _inlist_prev(node);
if (!pn)
- return;
+ {
+ if (node->parent && node->parent->parent && node->parent->parent->parent)
+ _tiling_window_tree_node_break_out(root, node, node->parent->parent->parent, dir);
+ return;
+ }
par = node->parent;
if ((eina_inlist_count(par->children) == 2) && /* swap if there are just 2 */
@@ -634,32 +641,37 @@ tiling_window_tree_node_change_pos(Window_Tree *node, int key)
Tiling_Split_Type parent_split_type =
_tiling_window_tree_split_type_get(node->parent);
- Window_Tree *root = node->parent;
+ Window_Tree *root = node->parent,
+ *grand_parent;
while(root->parent)
root = root->parent;
+
+ if (node->parent && node->parent->parent)
+ grand_parent = node->parent->parent;
+
switch(key)
{
case TILING_WINDOW_TREE_EDGE_LEFT:
if (parent_split_type == TILING_SPLIT_HORIZONTAL)
_tiling_window_tree_node_join(root, node, EINA_FALSE);
else if (parent_split_type == TILING_SPLIT_VERTICAL)
- _tiling_window_tree_node_break_out(root, node, EINA_FALSE);
+ _tiling_window_tree_node_break_out(root, node, grand_parent, EINA_FALSE);
break;
case TILING_WINDOW_TREE_EDGE_RIGHT:
if (parent_split_type == TILING_SPLIT_HORIZONTAL)
_tiling_window_tree_node_join(root, node, EINA_TRUE);
else if (parent_split_type == TILING_SPLIT_VERTICAL)
- _tiling_window_tree_node_break_out(root, node, EINA_TRUE);
+ _tiling_window_tree_node_break_out(root, node, grand_parent,EINA_TRUE);
break;
case TILING_WINDOW_TREE_EDGE_TOP:
if (parent_split_type == TILING_SPLIT_HORIZONTAL)
- _tiling_window_tree_node_break_out(root, node, EINA_FALSE);
+ _tiling_window_tree_node_break_out(root, node, grand_parent, EINA_FALSE);
else if (parent_split_type == TILING_SPLIT_VERTICAL)
_tiling_window_tree_node_join(root, node, EINA_FALSE);
break;
case TILING_WINDOW_TREE_EDGE_BOTTOM:
if (parent_split_type == TILING_SPLIT_HORIZONTAL)
- _tiling_window_tree_node_break_out(root, node, EINA_TRUE);
+ _tiling_window_tree_node_break_out(root, node, grand_parent, EINA_TRUE);
else if (parent_split_type == TILING_SPLIT_VERTICAL)
_tiling_window_tree_node_join(root, node, EINA_TRUE);
break;