aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/criteria.c2
-rw-r--r--sway/desktop/output.c2
-rw-r--r--sway/input/seat.c2
-rw-r--r--sway/tree/container.c21
4 files changed, 21 insertions, 6 deletions
diff --git a/sway/criteria.c b/sway/criteria.c
index 247f6b75..5fee1888 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -435,7 +435,7 @@ list_t *container_for_crit_tokens(list_t *tokens) {
struct list_tokens list_tokens =
(struct list_tokens){create_list(), tokens};
- container_for_each_descendent(&root_container,
+ container_for_each_descendant_dfs(&root_container,
(void (*)(struct sway_container *, void *))container_match_add,
&list_tokens);
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index ba778f4c..1273df59 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -228,7 +228,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
.output = soutput,
.now = &now,
};
- container_descendents(workspace, C_VIEW, output_frame_view, &rdata);
+ container_descendants(workspace, C_VIEW, output_frame_view, &rdata);
// render unmanaged views on top
struct sway_view *view;
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 76d29b52..aa0b1d50 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -130,7 +130,7 @@ struct sway_seat *sway_seat_create(struct sway_input_manager *input,
// init the focus stack
wl_list_init(&seat->focus_stack);
- container_for_each_descendent(&root_container, collect_focus_iter, seat);
+ container_for_each_descendant_dfs(&root_container, collect_focus_iter, seat);
wl_signal_add(&root_container.sway_root->events.new_container,
&seat->new_container);
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 40047dcf..6a6861f3 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -266,7 +266,7 @@ struct sway_container *container_set_layout(struct sway_container *container,
return container;
}
-void container_descendents(struct sway_container *root,
+void container_descendants(struct sway_container *root,
enum sway_container_type type,
void (*func)(struct sway_container *item, void *data), void *data) {
for (int i = 0; i < root->children->length; ++i) {
@@ -275,7 +275,7 @@ void container_descendents(struct sway_container *root,
func(item, data);
}
if (item->children && item->children->length) {
- container_descendents(item, type, func, data);
+ container_descendants(item, type, func, data);
}
}
}
@@ -400,7 +400,22 @@ struct sway_container *container_at(struct sway_container *parent,
return NULL;
}
-void container_for_each_descendent(struct sway_container *con,
+void container_for_each_descendant_dfs(struct sway_container *container,
+ void (*f)(struct sway_container *container, void *data),
+ void *data) {
+ if (container) {
+ if (container->children) {
+ for (int i = 0; i < container->children->length; ++i) {
+ struct sway_container *child =
+ container->children->items[i];
+ container_for_each_descendant_dfs(child, f, data);
+ }
+ }
+ f(container, data);
+ }
+}
+
+void container_for_each_descendant_bfs(struct sway_container *con,
void (*f)(struct sway_container *con, void *data), void *data) {
list_t *queue = get_bfs_queue();
if (!queue) {