libweston: delete paint nodes on view unmap

Paint nodes should only exist when they're visible.

In the future where we want to track damage with paint nodes we need
this to be enforced, or damage won't properly be tracked when a
paint node is hidden from us but continues to exist.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2023-06-27 07:28:37 -05:00
parent 7ab7f28e8c
commit e5dfc3bc1e
1 changed files with 6 additions and 4 deletions

View File

@ -2186,6 +2186,7 @@ weston_compositor_repick(struct weston_compositor *compositor)
WL_EXPORT void
weston_view_unmap(struct weston_view *view)
{
struct weston_paint_node *pnode, *pntmp;
struct weston_seat *seat;
struct weston_view *child;
@ -2230,6 +2231,10 @@ weston_view_unmap(struct weston_view *view)
}
}
}
wl_list_for_each_safe(pnode, pntmp, &view->paint_node_list, view_link)
weston_paint_node_destroy(pnode);
weston_signal_emit_mutable(&view->unmap_signal, view);
view->surface->compositor->view_list_needs_rebuild = true;
}
@ -2257,8 +2262,6 @@ weston_surface_unmap(struct weston_surface *surface)
WL_EXPORT void
weston_view_destroy(struct weston_view *view)
{
struct weston_paint_node *pnode, *pntmp;
if (weston_view_is_mapped(view))
weston_view_unmap(view);
@ -2266,8 +2269,7 @@ weston_view_destroy(struct weston_view *view)
assert(wl_list_empty(&view->geometry.child_list));
wl_list_for_each_safe(pnode, pntmp, &view->paint_node_list, view_link)
weston_paint_node_destroy(pnode);
assert(wl_list_empty(&view->paint_node_list));
if (!wl_list_empty(&view->link))
view->surface->compositor->view_list_needs_rebuild = true;