From 37462c7cb73cb717cf516c746cf0bc21beca1496 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 28 Aug 2014 16:30:17 +0100 Subject: [PATCH] Tiling: Respect min size hints (set to floating if doesn't fit). This fix floats all the windows that don't fit because of their min size restrictions. It can be made better, at the moment it is very simple. An example broken case would be the following: Assume we have 3 windows, A, B and C. B and C both hand a min width of half the screen. First we create A, then B. Everything works as they share the screen, but when we add C, both B's and C's restrictions "fail" so they are both set to float although in reality, floating C is enough. This can be fixed by doing a live scan of the tree every time a window is floated, though it's not essential at the moment. Fixes T952. --- src/modules/tiling/e_mod_tiling.c | 6 ++++++ src/modules/tiling/e_mod_tiling.h | 1 + src/modules/tiling/window_tree.c | 36 +++++++++++++++++++++++++------ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/modules/tiling/e_mod_tiling.c b/src/modules/tiling/e_mod_tiling.c index d82564278..a5491014c 100644 --- a/src/modules/tiling/e_mod_tiling.c +++ b/src/modules/tiling/e_mod_tiling.c @@ -703,6 +703,12 @@ toggle_floating(E_Client *ec) } } +void +tiling_e_client_does_not_fit(E_Client *ec) +{ + toggle_floating(ec); +} + static void _e_mod_action_toggle_floating_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED) diff --git a/src/modules/tiling/e_mod_tiling.h b/src/modules/tiling/e_mod_tiling.h index 6e315597d..f54a8a840 100644 --- a/src/modules/tiling/e_mod_tiling.h +++ b/src/modules/tiling/e_mod_tiling.h @@ -84,6 +84,7 @@ struct _Config_vdesk *get_vdesk(Eina_List *vdesks, int x, int y, void tiling_e_client_move_resize_extra(E_Client *ec, int x, int y, int w, int h); +void tiling_e_client_does_not_fit(E_Client *ec); # define EINA_LIST_IS_IN(_list, _el) \ (eina_list_data_find(_list, _el) == _el) # define EINA_LIST_APPEND(_list, _el) \ diff --git a/src/modules/tiling/window_tree.c b/src/modules/tiling/window_tree.c index 09df02b32..f29593c90 100644 --- a/src/modules/tiling/window_tree.c +++ b/src/modules/tiling/window_tree.c @@ -269,7 +269,8 @@ tiling_window_tree_client_find(Window_Tree *root, E_Client *client) void _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, - Evas_Coord w, Evas_Coord h, int level, Evas_Coord padding) + Evas_Coord w, Evas_Coord h, int level, Evas_Coord padding, + Eina_List **floaters) { Window_Tree *itr; Tiling_Split_Type split_type = level % 2; @@ -278,8 +279,18 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, if (root->client) { if (!e_object_is_del(E_OBJECT(root->client))) - tiling_e_client_move_resize_extra(root->client, x, y, - w - padding, h - padding); + { + if ((root->client->icccm.min_w > (w - padding)) || + (root->client->icccm.min_h > (h - padding))) + { + *floaters = eina_list_append(*floaters, root->client); + } + else + { + tiling_e_client_move_resize_extra(root->client, x, y, + w - padding, h - padding); + } + } return; } @@ -290,7 +301,7 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, Evas_Coord itw = w * itr->weight; total_weight += itr->weight; - _tiling_window_tree_level_apply(itr, x, y, itw, h, level + 1, padding); + _tiling_window_tree_level_apply(itr, x, y, itw, h, level + 1, padding, floaters); x += itw; } } @@ -301,7 +312,7 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, Evas_Coord ith = h * itr->weight; total_weight += itr->weight; - _tiling_window_tree_level_apply(itr, x, y, w, ith, level + 1, padding); + _tiling_window_tree_level_apply(itr, x, y, w, ith, level + 1, padding, floaters); y += ith; } } @@ -314,8 +325,19 @@ void tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Evas_Coord padding) { - _tiling_window_tree_level_apply(root, x + padding, y + padding, - w - padding, h - padding, 0, padding); + Eina_List *floaters = NULL; + E_Client *ec; + + x += padding; + y += padding; + w -= padding; + h -= padding; + _tiling_window_tree_level_apply(root, x, y, w, h, 0, padding, &floaters); + + EINA_LIST_FREE(floaters, ec) + { + tiling_e_client_does_not_fit(ec); + } } static Window_Tree *