From ae8acb24b2821459b0d69c6db1dc255bcdc35ef5 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 16 Jan 2014 15:16:28 +0000 Subject: [PATCH] Tiling2: Fixed resizing of clients at "forbidden" borders. For example, leftmost window's left border. --- src/modules/tiling/e_mod_tiling.c | 5 ++++- src/modules/tiling/window_tree.c | 27 +++++++++++++++++++++------ src/modules/tiling/window_tree.h | 2 +- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/modules/tiling/e_mod_tiling.c b/src/modules/tiling/e_mod_tiling.c index 0f08f67..6965dad 100644 --- a/src/modules/tiling/e_mod_tiling.c +++ b/src/modules/tiling/e_mod_tiling.c @@ -722,7 +722,10 @@ static void _move_or_resize(E_Client *ec) } if ((w_diff != 1.0) || (h_diff != 1.0)) { - tiling_window_tree_node_resize(item, w_dir, w_diff, h_dir, h_diff); + if (!tiling_window_tree_node_resize(item, w_dir, w_diff, h_dir, h_diff)) + { + /* FIXME: Do something? */ + } } } diff --git a/src/modules/tiling/window_tree.c b/src/modules/tiling/window_tree.c index 107ee41..0ecc77a 100644 --- a/src/modules/tiling/window_tree.c +++ b/src/modules/tiling/window_tree.c @@ -299,7 +299,7 @@ _inlist_prev(Window_Tree *it) return (Window_Tree *) EINA_INLIST_GET(it)->prev; } -static void +static Eina_Bool _tiling_window_tree_node_resize_direction(Window_Tree *node, Window_Tree *parent, double dir_diff, int dir) { @@ -329,8 +329,18 @@ _tiling_window_tree_node_resize_direction(Window_Tree *node, Window_Tree *parent itr = itr_func(itr); } + /* If it's at the edge, try the grandpa of the parent. */ if (weight == 0.0) - return; + { + if (parent->parent && parent->parent->parent) + { + return _tiling_window_tree_node_resize_direction(parent->parent, + parent->parent->parent, + 1.0 + ((dir_diff - 1.) * node->weight), + dir); + } + return EINA_FALSE; + } weight_diff = itr->weight; itr->weight *= dir_diff; @@ -341,17 +351,20 @@ _tiling_window_tree_node_resize_direction(Window_Tree *node, Window_Tree *parent { itr->weight += itr->weight * weight_diff; } + + return EINA_TRUE; } -void +Eina_Bool tiling_window_tree_node_resize(Window_Tree *node, int w_dir, double w_diff, int h_dir, double h_diff) { Window_Tree *parent = node->parent; Window_Tree *w_parent, *h_parent; + Eina_Bool ret = EINA_FALSE; /* If we have no parent, means we need to be full screen anyway. */ if (!parent) - return; + return EINA_FALSE; Window_Tree *grand_parent = parent->parent; Tiling_Split_Type parent_split_type = _tiling_window_tree_split_type_get(parent); @@ -371,14 +384,16 @@ tiling_window_tree_node_resize(Window_Tree *node, int w_dir, double w_diff, int if ((h_diff != 1.0) && h_parent) { Window_Tree *tmp_node = (h_parent == parent) ? node : parent; - _tiling_window_tree_node_resize_direction(tmp_node, h_parent, h_diff, h_dir); + ret = ret || _tiling_window_tree_node_resize_direction(tmp_node, h_parent, h_diff, h_dir); } if ((w_diff != 1.0) && w_parent) { Window_Tree *tmp_node = (w_parent == parent) ? node : parent; - _tiling_window_tree_node_resize_direction(tmp_node, w_parent, w_diff, w_dir); + ret = ret || _tiling_window_tree_node_resize_direction(tmp_node, w_parent, w_diff, w_dir); } + + return ret; } void diff --git a/src/modules/tiling/window_tree.h b/src/modules/tiling/window_tree.h index 5241e27..6cca18c 100644 --- a/src/modules/tiling/window_tree.h +++ b/src/modules/tiling/window_tree.h @@ -32,6 +32,6 @@ Window_Tree *tiling_window_tree_client_find(Window_Tree *root, E_Client *client) void tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); -void tiling_window_tree_node_resize(Window_Tree *node, int w_dir, double w_diff, int h_dir, double h_diff); +Eina_Bool tiling_window_tree_node_resize(Window_Tree *node, int w_dir, double w_diff, int h_dir, double h_diff); #endif -- 2.7.4