diff options
-rw-r--r-- | sway/tree/container.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 35f67cce..99d57218 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -674,16 +674,23 @@ struct sway_container *floating_container_at(double lx, double ly, | |||
674 | void container_for_each_descendant_dfs(struct sway_container *container, | 674 | void container_for_each_descendant_dfs(struct sway_container *container, |
675 | void (*f)(struct sway_container *container, void *data), | 675 | void (*f)(struct sway_container *container, void *data), |
676 | void *data) { | 676 | void *data) { |
677 | if (container) { | 677 | if (!container) { |
678 | if (container->children) { | 678 | return; |
679 | for (int i = 0; i < container->children->length; ++i) { | 679 | } |
680 | struct sway_container *child = | 680 | if (container->children) { |
681 | container->children->items[i]; | 681 | for (int i = 0; i < container->children->length; ++i) { |
682 | container_for_each_descendant_dfs(child, f, data); | 682 | struct sway_container *child = container->children->items[i]; |
683 | } | 683 | container_for_each_descendant_dfs(child, f, data); |
684 | } | ||
685 | } | ||
686 | if (container->type == C_WORKSPACE) { | ||
687 | struct sway_container *floating = container->sway_workspace->floating; | ||
688 | for (int i = 0; i < floating->children->length; ++i) { | ||
689 | struct sway_container *child = floating->children->items[i]; | ||
690 | container_for_each_descendant_dfs(child, f, data); | ||
684 | } | 691 | } |
685 | f(container, data); | ||
686 | } | 692 | } |
693 | f(container, data); | ||
687 | } | 694 | } |
688 | 695 | ||
689 | void container_for_each_descendant_bfs(struct sway_container *con, | 696 | void container_for_each_descendant_bfs(struct sway_container *con, |