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

View file

@ -58,6 +58,12 @@ is_primary(struct cg_view *view)
return parent == NULL; /*&& role == WLR_XDG_SURFACE_ROLE_TOPLEVEL */
}
static bool
is_parent(struct cg_view *parent, struct cg_view *child)
{
return child->xdg_surface->toplevel->parent == parent->xdg_surface;
}
static void
handle_xdg_shell_surface_unmap(struct wl_listener *listener, void *data)
{
@ -106,4 +112,5 @@ handle_xdg_shell_surface_new(struct wl_listener *listener, void *data)
view->for_each_surface = for_each_surface;
view->wlr_surface_at = wlr_surface_at;
view->is_primary = is_primary;
view->is_parent = is_parent;
}