From e6609541b1863e17f268c6b66ff42621e4dc1f06 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 21 Jul 2020 14:46:04 +0200 Subject: [PATCH] tiling: prevent potential recursive apply calls additionally, this ensures that clients that cannot be layouted are definitly outside the tree. Without applying the window tree again. With all this tiling can be used quite normally. If you want to know exactly what is going on, set notify level to info, then tiling tells you what cannot be tiled. --- src/modules/tiling/e_mod_tiling.c | 26 +++++++++++++++++++++++--- src/modules/tiling/window_tree.c | 10 +++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/modules/tiling/e_mod_tiling.c b/src/modules/tiling/e_mod_tiling.c index fba3f1a8e..9bbed0ff4 100644 --- a/src/modules/tiling/e_mod_tiling.c +++ b/src/modules/tiling/e_mod_tiling.c @@ -115,6 +115,7 @@ static struct tiling_mod_main_g *act_move_right, *act_toggle_split_mode, *act_swap_window; Desk_Split_Type *current_split_type; + Ecore_Job *apply_tree_job; struct { Evas_Object *comp_obj; @@ -480,7 +481,7 @@ _reapply_tree(void) if (zw > 0 && zh > 0) tiling_window_tree_apply(_G.tinfo->tree, zx, zy, zw, zh, tiling_g.config->window_padding, - EINA_FALSE); + EINA_TRUE); else ERR("The zone desk geometry was not useful at all (%d,%d,%d,%d)", zx, zy, zw, zh); } @@ -859,11 +860,22 @@ toggle_floating(E_Client *ec) } } +static void +_window_tree_apply_delayed(void *data EINA_UNUSED) +{ + _reapply_tree(); + ecore_job_del(_G.apply_tree_job); + _G.apply_tree_job = NULL; +} + void tiling_e_client_does_not_fit(E_Client *ec) { E_Notification_Notify n; Eina_Strbuf *buf; + Client_Extra *extra = tiling_entry_no_desk_func(ec); + + EINA_SAFETY_ON_NULL_RETURN(extra); buf = eina_strbuf_new(); eina_strbuf_append_printf(buf, _("Window %s cannot be tiled\n"), @@ -876,9 +888,17 @@ tiling_e_client_does_not_fit(E_Client *ec) n.body = eina_strbuf_string_get(buf); n.timeout = 8000; e_notification_client_send(&n, NULL, NULL); - toggle_floating(ec); - eina_strbuf_string_free(buf); + + EINA_SAFETY_ON_TRUE_RETURN(extra->floating); + + //remove the client here without applying the tree again to break maybe possible recursions + { + extra->floating = EINA_TRUE; + _restore_client(ec); + _client_remove_no_apply(ec); + _G.apply_tree_job = ecore_job_add(_window_tree_apply_delayed, NULL); + } } static void diff --git a/src/modules/tiling/window_tree.c b/src/modules/tiling/window_tree.c index fa3fa8da6..f9800a2c6 100644 --- a/src/modules/tiling/window_tree.c +++ b/src/modules/tiling/window_tree.c @@ -306,10 +306,14 @@ _tiling_window_tree_level_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y, if (!e_object_is_del(E_OBJECT(root->client))) { if ((root->client->icccm.min_w > (w - padding)) || - (root->client->icccm.min_h > (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); + } else { + tiling_e_client_move_resize_extra(root->client, x, y, + w - padding, h - padding); + } + + } return; }