mirror of
https://github.com/NickHu/sway
synced 2024-12-27 21:58:11 +01:00
Fix oversights from previous pull request
This commit is contained in:
parent
dc8c9fbeb6
commit
8f490d7d2d
5 changed files with 29 additions and 8 deletions
|
@ -104,7 +104,7 @@ struct sway_container *container_view_destroy(struct sway_container *view);
|
|||
struct sway_container *container_set_layout(struct sway_container *container,
|
||||
enum sway_container_layout layout);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -131,7 +131,13 @@ struct sway_container *container_at(struct sway_container *parent,
|
|||
/**
|
||||
* Apply the function for each child of the container breadth first.
|
||||
*/
|
||||
void container_for_each_descendent(struct sway_container *container,
|
||||
void container_for_each_descendant_bfs(struct sway_container *container,
|
||||
void (*f)(struct sway_container *container, void *data), void *data);
|
||||
|
||||
/**
|
||||
* Apply the function for each child of the container depth first.
|
||||
*/
|
||||
void container_for_each_descendant_dfs(struct sway_container *container,
|
||||
void (*f)(struct sway_container *container, void *data), void *data);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue