summaryrefslogtreecommitdiff
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2017-11-25 10:59:49 -0500
committerDrew DeVault <[email protected]>2017-11-25 11:19:25 -0500
commitce1936bc65d01502e3a5f8681bb039cb95e82e0c (patch)
treefcdeb554df5aaf30aff7723171e0dfe0bf097420 /sway/tree/container.c
parent289ba64bdea0ed3d42fb195b64e19e0cac799c97 (diff)
Arrange windows on desktop
Diffstat (limited to 'sway/tree/container.c')
-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 d3931612..a83c0f6b 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -108,3 +108,16 @@ swayc_t *new_view(swayc_t *sibling, struct sway_view *sway_view) {
}
return swayc;
}
+
+swayc_t *swayc_parent_by_type(swayc_t *container, enum swayc_types type) {
+ if (!sway_assert(container, "container is NULL")) {
+ return NULL;
+ }
+ if (!sway_assert(type < C_TYPES && type >= C_ROOT, "invalid type")) {
+ return NULL;
+ }
+ do {
+ container = container->parent;
+ } while (container && container->type != type);
+ return container;
+}