]> git.sur5r.net Git - i3/i3/commitdiff
Render only once for all matching assignments (Thanks rami)
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 15 Feb 2012 21:02:40 +0000 (21:02 +0000)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 15 Feb 2012 21:02:40 +0000 (21:02 +0000)
Fixes: #608
src/assignments.c

index eae87272a3c6bb746eb0102ebb4926bd436b68e3..09793c38d7b456f9f4375b760bde9b7a930c21db 100644 (file)
@@ -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();
 }
 
 /*