view: add view_is_related()

Allows removing xwayland-specific stuff from seat.c.

Based on a suggestion from @Consolatis.

v2: add comments
This commit is contained in:
John Lindgren 2023-10-15 00:15:16 -04:00 committed by Consolatis
parent 9b0031aec4
commit 5c4038493f
4 changed files with 38 additions and 21 deletions

View file

@ -614,6 +614,18 @@ xwayland_view_append_children(struct view *self, struct wl_array *children)
}
}
static bool
xwayland_view_is_related(struct view *view, struct wlr_surface *surface)
{
struct wlr_xwayland_surface *xsurface =
xwayland_surface_from_view(view);
struct wlr_xwayland_surface *xsurface2 =
wlr_surface_is_xwayland_surface(surface) ?
wlr_xwayland_surface_from_wlr_surface(surface) : NULL;
return (xsurface2 && xsurface2->pid == xsurface->pid);
}
static void
xwayland_view_set_activated(struct view *view, bool activated)
{
@ -659,6 +671,7 @@ static const struct view_impl xwayland_view_impl = {
.move_to_back = xwayland_view_move_to_back,
.get_root = xwayland_view_get_root,
.append_children = xwayland_view_append_children,
.is_related = xwayland_view_is_related,
.get_size_hints = xwayland_view_get_size_hints,
.wants_focus = xwayland_view_wants_focus,
};