refactor swayc_tabbed_stacked_parent into _ancestor and _parent and use where needed

This commit is contained in:
D.B 2016-07-16 15:11:08 +02:00
parent 7aeedf0264
commit ad7605675e
7 changed files with 24 additions and 7 deletions

View file

@ -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;
}