view: add view_has_children to query if a view has children

This allows us to check per-view whether is has dialogs open, instead of
diong it on a global basis as we are doing currently. This is necessary
for fully supporting multiple primary clients.
This commit is contained in:
Jente Hidskes 2019-01-12 17:51:17 +01:00
parent 112a662ebc
commit b0bd4e680d
4 changed files with 28 additions and 0 deletions

12
view.c
View file

@ -68,6 +68,18 @@ view_is_primary(struct cg_view *view)
return view->is_primary(view);
}
bool
view_has_children(struct cg_server *server, struct cg_view *parent)
{
struct cg_view *child;
wl_list_for_each(child, &server->views, link) {
if (parent != child && parent->is_parent(parent, child)) {
return true;
}
}
return false;
}
void
view_position(struct cg_view *view)
{