diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-02-10 16:52:45 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-02-10 16:52:45 -0500 |
commit | 145b4fdf582d3817a19819250cf01836b193c76f (patch) | |
tree | f7c81a0094c10ca202ac8665223789ff4179e11c /sway/tree | |
parent | 095ddb1561001f21b812dbe0daa5e06bc688ed98 (diff) |
use bfs iterator to collect focus stack
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 67fac5ee..ebf9f98e 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -381,13 +381,13 @@ void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), voi } } -/** - * Get a list of containers that are descendents of the container in rendering - * order - */ -list_t *container_list_children(swayc_t *con) { - list_t *list = create_list(); +void container_for_each_bfs(swayc_t *con, void (*f)(swayc_t *con, void *data), + void *data) { list_t *queue = create_list(); + if (queue == NULL) { + wlr_log(L_ERROR, "could not allocate list"); + return; + } list_add(queue, con); @@ -395,11 +395,10 @@ list_t *container_list_children(swayc_t *con) { while (queue->length) { current = queue->items[0]; list_del(queue, 0); - list_add(list, current); + f(current, data); // TODO floating containers list_cat(queue, current->children); } list_free(queue); - return list; } |