From: Michael Stapelberg Date: Wed, 15 Feb 2012 21:02:40 +0000 (+0000) Subject: Render only once for all matching assignments (Thanks rami) X-Git-Tag: 4.2~71 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3827d3758c2b5150c8eeb0eaa2d5759fbbcdb77c;p=i3%2Fi3 Render only once for all matching assignments (Thanks rami) Fixes: #608 --- diff --git a/src/assignments.c b/src/assignments.c index eae87272..09793c38 100644 --- a/src/assignments.c +++ b/src/assignments.c @@ -17,6 +17,8 @@ void run_assignments(i3Window *window) { DLOG("Checking if any assignments match this window\n"); + bool needs_tree_render = false; + /* Check if any assignments match */ Assignment *current; TAILQ_FOREACH(current, &assignments, assignments) { @@ -45,7 +47,7 @@ void run_assignments(i3Window *window) { free(full_command); if (command_output->needs_tree_render) - tree_render(); + needs_tree_render = true; free(command_output->json_output); } @@ -55,6 +57,10 @@ void run_assignments(i3Window *window) { window->ran_assignments = srealloc(window->ran_assignments, sizeof(Assignment*) * window->nr_assignments); window->ran_assignments[window->nr_assignments-1] = current; } + + /* If any of the commands required re-rendering, we will do that now. */ + if (needs_tree_render) + tree_render(); } /*