diff options
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sway/container.c b/sway/container.c index 9d5e2690..4f22eb0d 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -727,14 +727,29 @@ swayc_t *container_find(swayc_t *container, bool (*f)(swayc_t *, const void *), | |||
727 | return NULL; | 727 | return NULL; |
728 | } | 728 | } |
729 | 729 | ||
730 | swayc_t *con; | ||
731 | if (container->type == C_WORKSPACE) { | ||
732 | for (int i = 0; i < container->floating->length; ++i) { | ||
733 | con = container->floating->items[i]; | ||
734 | if (f(con, data)) { | ||
735 | return con; | ||
736 | } | ||
737 | con = container_find(con, f, data); | ||
738 | if (con != NULL) { | ||
739 | return con; | ||
740 | } | ||
741 | } | ||
742 | } | ||
743 | |||
730 | for (int i = 0; i < container->children->length; ++i) { | 744 | for (int i = 0; i < container->children->length; ++i) { |
731 | if (f(container->children->items[i], data)) { | 745 | con = container->children->items[i]; |
732 | return container->children->items[i]; | 746 | if (f(con, data)) { |
747 | return con; | ||
733 | } | 748 | } |
734 | 749 | ||
735 | swayc_t *find = container_find(container->children->items[i], f, data); | 750 | con = container_find(con, f, data); |
736 | if (find != NULL) { | 751 | if (con != NULL) { |
737 | return find; | 752 | return con; |
738 | } | 753 | } |
739 | } | 754 | } |
740 | 755 | ||