aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index f972ac24..e2fe9e7c 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -401,3 +401,16 @@ bool container_has_anscestor(struct sway_container *descendant,
}
return false;
}
+
+bool find_child_func(struct sway_container *con, void *data) {
+ struct sway_container *child = data;
+ return con == child;
+}
+
+bool container_has_child(struct sway_container *con,
+ struct sway_container *child) {
+ if (child->type == C_VIEW || child->children->length == 0) {
+ return false;
+ }
+ return container_find(con, find_child_func, child);
+}