aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-05-12 12:37:48 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-05-12 12:37:48 -0400
commite3625d8f337d61c5d2ba1266679b9053168cd0ae (patch)
tree496ed7323dfead9e048a146fcfede4ef255b1a97 /sway/tree/container.c
parentImplement hide_edge_borders (diff)
downloadsway-e3625d8f337d61c5d2ba1266679b9053168cd0ae.tar.gz
sway-e3625d8f337d61c5d2ba1266679b9053168cd0ae.tar.zst
sway-e3625d8f337d61c5d2ba1266679b9053168cd0ae.zip
Count descendant views for hide_edge_borders smart
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index db02c69c..c26afdd8 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -547,6 +547,20 @@ bool container_has_child(struct sway_container *con,
547 return container_find(con, find_child_func, child); 547 return container_find(con, find_child_func, child);
548} 548}
549 549
550int container_count_descendants_of_type(struct sway_container *con,
551 enum sway_container_type type) {
552 int children = 0;
553 if (con->type == type) {
554 children++;
555 } else if (con->children) {
556 for (int i = 0; i < con->children->length; i++) {
557 struct sway_container *child = con->children->items[i];
558 children += container_count_descendants_of_type(child, type);
559 }
560 }
561 return children;
562}
563
550void container_damage_whole(struct sway_container *container) { 564void container_damage_whole(struct sway_container *container) {
551 for (int i = 0; i < root_container.children->length; ++i) { 565 for (int i = 0; i < root_container.children->length; ++i) {
552 struct sway_container *cont = root_container.children->items[i]; 566 struct sway_container *cont = root_container.children->items[i];