From a172d930dafaa4b77df21f35cfb4873c459fd71a Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 10 Aug 2019 10:57:09 +0100 Subject: [PATCH] tiling - ignore min size for layout of tree to avoid insta-floats so some clients just cant tile due to min size and this leads to really bad results so pass the problem back to the user to go resize them up to fit. this probably needs far more extensive layout logic. the data struct is a tree but perhaps it needs to flatten out into a table to make layouting more sane. but that's the future. for now be less bad today. --- src/modules/tiling/e_mod_tiling.c | 3 ++- src/modules/tiling/window_tree.c | 33 +++++++++++++++++++------------ src/modules/tiling/window_tree.h | 8 ++++++-- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/modules/tiling/e_mod_tiling.c b/src/modules/tiling/e_mod_tiling.c index c7813d5a0..bf41fa7f3 100644 --- a/src/modules/tiling/e_mod_tiling.c +++ b/src/modules/tiling/e_mod_tiling.c @@ -479,7 +479,8 @@ _reapply_tree(void) if (zw > 0 && zh > 0) tiling_window_tree_apply(_G.tinfo->tree, zx, zy, zw, zh, - tiling_g.config->window_padding); + tiling_g.config->window_padding, + EINA_FALSE); else ERR("The zone desk geometry was not useful at all (%d,%d,%d,%d)", zx, zy, zw, zh); } diff --git a/src/modules/tiling/window_tree.c b/src/modules/tiling/window_tree.c index fab456322..fa3fa8da6 100644 --- a/src/modules/tiling/window_tree.c +++ b/src/modules/tiling/window_tree.c @@ -296,20 +296,20 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, Tiling_Split_Type split_type = level % 2; double total_weight = 0.0; + root->space.x = x; + root->space.y = y; + root->space.w = w - padding; + root->space.h = h - padding; + if (root->client) { if (!e_object_is_del(E_OBJECT(root->client))) { 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); - } + (root->client->icccm.min_h > (h - padding))) + *floaters = eina_list_append(*floaters, root->client); + tiling_e_client_move_resize_extra(root->client, x, y, + w - padding, h - padding); } return; } @@ -341,9 +341,10 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, ((Window_Tree *)(void *)root->children->last)->weight += 1.0 - total_weight; } -void +Eina_Bool tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, - Evas_Coord w, Evas_Coord h, Evas_Coord padding) + Evas_Coord w, Evas_Coord h, Evas_Coord padding, + Eina_Bool force_float) { Eina_List *floaters = NULL; E_Client *ec; @@ -354,10 +355,16 @@ tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, h -= padding; _tiling_window_tree_level_apply(root, x, y, w, h, 0, padding, &floaters); - EINA_LIST_FREE(floaters, ec) + if (floaters) { - tiling_e_client_does_not_fit(ec); + // some clients failed to properly fit and maybe SHOULD float + EINA_LIST_FREE(floaters, ec) + { + if (force_float) tiling_e_client_does_not_fit(ec); + } + return EINA_FALSE; } + return EINA_TRUE; } static Window_Tree * diff --git a/src/modules/tiling/window_tree.h b/src/modules/tiling/window_tree.h index 364305c3d..a410e7873 100644 --- a/src/modules/tiling/window_tree.h +++ b/src/modules/tiling/window_tree.h @@ -21,6 +21,9 @@ struct _Window_Tree /* FIXME: client is falid iff children is null. Sholud enforce it. */ Eina_Inlist *children; /* Window_Tree * type */ E_Client *client; + struct { + int x, y, w, h; + } space; double weight; }; @@ -52,8 +55,9 @@ Window_Tree *tiling_window_tree_remove(Window_Tree *root, Window_Tree *item); 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, Evas_Coord padding); +Eina_Bool tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, + Evas_Coord w, Evas_Coord h, Evas_Coord padding, + Eina_Bool force_float); Eina_Bool tiling_window_tree_node_resize(Window_Tree *node, int w_dir, double w_diff, int h_dir, double h_diff);