summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2020-07-21 14:46:04 +0200
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-07-26 17:27:50 +0100
commitd42adad715c7e8dfef425411f6e31052968b3ced (patch)
tree655dff33c396428d1a72edf178af2e0b3008239c
parent6a3648a5fdd621897f53b8ece5d95c6bb7b9dfec (diff)
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.
-rw-r--r--src/modules/tiling/e_mod_tiling.c26
-rw-r--r--src/modules/tiling/window_tree.c10
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
115 *act_move_right, *act_toggle_split_mode, *act_swap_window; 115 *act_move_right, *act_toggle_split_mode, *act_swap_window;
116 116
117 Desk_Split_Type *current_split_type; 117 Desk_Split_Type *current_split_type;
118 Ecore_Job *apply_tree_job;
118 119
119 struct { 120 struct {
120 Evas_Object *comp_obj; 121 Evas_Object *comp_obj;
@@ -480,7 +481,7 @@ _reapply_tree(void)
480 if (zw > 0 && zh > 0) 481 if (zw > 0 && zh > 0)
481 tiling_window_tree_apply(_G.tinfo->tree, zx, zy, zw, zh, 482 tiling_window_tree_apply(_G.tinfo->tree, zx, zy, zw, zh,
482 tiling_g.config->window_padding, 483 tiling_g.config->window_padding,
483 EINA_FALSE); 484 EINA_TRUE);
484 else 485 else
485 ERR("The zone desk geometry was not useful at all (%d,%d,%d,%d)", zx, zy, zw, zh); 486 ERR("The zone desk geometry was not useful at all (%d,%d,%d,%d)", zx, zy, zw, zh);
486 } 487 }
@@ -859,11 +860,22 @@ toggle_floating(E_Client *ec)
859 } 860 }
860} 861}
861 862
863static void
864_window_tree_apply_delayed(void *data EINA_UNUSED)
865{
866 _reapply_tree();
867 ecore_job_del(_G.apply_tree_job);
868 _G.apply_tree_job = NULL;
869}
870
862void 871void
863tiling_e_client_does_not_fit(E_Client *ec) 872tiling_e_client_does_not_fit(E_Client *ec)
864{ 873{
865 E_Notification_Notify n; 874 E_Notification_Notify n;
866 Eina_Strbuf *buf; 875 Eina_Strbuf *buf;
876 Client_Extra *extra = tiling_entry_no_desk_func(ec);
877
878 EINA_SAFETY_ON_NULL_RETURN(extra);
867 879
868 buf = eina_strbuf_new(); 880 buf = eina_strbuf_new();
869 eina_strbuf_append_printf(buf, _("Window %s cannot be tiled\n"), 881 eina_strbuf_append_printf(buf, _("Window %s cannot be tiled\n"),
@@ -876,9 +888,17 @@ tiling_e_client_does_not_fit(E_Client *ec)
876 n.body = eina_strbuf_string_get(buf); 888 n.body = eina_strbuf_string_get(buf);
877 n.timeout = 8000; 889 n.timeout = 8000;
878 e_notification_client_send(&n, NULL, NULL); 890 e_notification_client_send(&n, NULL, NULL);
879 toggle_floating(ec);
880
881 eina_strbuf_string_free(buf); 891 eina_strbuf_string_free(buf);
892
893 EINA_SAFETY_ON_TRUE_RETURN(extra->floating);
894
895 //remove the client here without applying the tree again to break maybe possible recursions
896 {
897 extra->floating = EINA_TRUE;
898 _restore_client(ec);
899 _client_remove_no_apply(ec);
900 _G.apply_tree_job = ecore_job_add(_window_tree_apply_delayed, NULL);
901 }
882} 902}
883 903
884static void 904static 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,
306 if (!e_object_is_del(E_OBJECT(root->client))) 306 if (!e_object_is_del(E_OBJECT(root->client)))
307 { 307 {
308 if ((root->client->icccm.min_w > (w - padding)) || 308 if ((root->client->icccm.min_w > (w - padding)) ||
309 (root->client->icccm.min_h > (h - padding))) 309 (root->client->icccm.min_h > (h - padding))) {
310 *floaters = eina_list_append(*floaters, root->client); 310 *floaters = eina_list_append(*floaters, root->client);
311 tiling_e_client_move_resize_extra(root->client, x, y, 311 } else {
312 w - padding, h - padding); 312 tiling_e_client_move_resize_extra(root->client, x, y,
313 w - padding, h - padding);
314 }
315
316
313 } 317 }
314 return; 318 return;
315 } 319 }