From ad7605675ef5d1fc99653e80c3c846429abfda25 Mon Sep 17 00:00:00 2001 From: "D.B" Date: Sat, 16 Jul 2016 15:11:08 +0200 Subject: refactor swayc_tabbed_stacked_parent into _ancestor and _parent and use where needed --- sway/container.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index ae70a8ee..bffbe620 100644 --- a/sway/container.c +++ b/sway/container.c @@ -878,7 +878,7 @@ void close_views(swayc_t *container) { container_map(container, close_view, NULL); } -swayc_t *swayc_tabbed_stacked_parent(swayc_t *view) { +swayc_t *swayc_tabbed_stacked_ancestor(swayc_t *view) { swayc_t *parent = NULL; if (!ASSERT_NONNULL(view)) { return NULL; @@ -892,3 +892,13 @@ swayc_t *swayc_tabbed_stacked_parent(swayc_t *view) { return parent; } + +swayc_t *swayc_tabbed_stacked_parent(swayc_t *con) { + if (!ASSERT_NONNULL(con)) { + return NULL; + } + if (con->parent && (con->parent->layout == L_TABBED || con->parent->layout == L_STACKED)) { + return con->parent; + } + return NULL; +} -- cgit v1.2.3