From 5fe02dc68e08f02f75bf7347392f0a7600be4979 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Mon, 5 Aug 2024 11:00:13 -0500 Subject: [PATCH] compositor: Destroy paint nodes in weston_view_move_to_layer() Commit f2486c8b962327 removed some helper functions for layer changes, but the loop to delete stale paint nodes was elided. We need to delete paint nodes on a layer change to ensure damage is tracked properly. Fixes f2486c8b962327 Fixes #937 Signed-off-by: Derek Foreman --- libweston/compositor.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index 83fec7d1..db6476b6 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -2568,10 +2568,18 @@ weston_compositor_repick(struct weston_compositor *compositor) weston_seat_repick(seat); } +static void +weston_view_destroy_paint_nodes(struct weston_view *view) +{ + struct weston_paint_node *pnode, *pntmp; + + wl_list_for_each_safe(pnode, pntmp, &view->paint_node_list, view_link) + weston_paint_node_destroy(pnode); +} + WL_EXPORT void weston_view_unmap(struct weston_view *view) { - struct weston_paint_node *pnode, *pntmp; struct weston_seat *seat; struct weston_view *child; @@ -2618,8 +2626,7 @@ 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_view_destroy_paint_nodes(view); wl_signal_emit_mutable(&view->unmap_signal, view); view->surface->compositor->view_list_needs_rebuild = true; @@ -4149,7 +4156,15 @@ weston_view_move_to_layer(struct weston_view *view, /* Damage the view's old region, and remove it from the layer. */ if (weston_view_is_mapped(view)) { - weston_view_damage_below(view); + /* Remove all paint nodes because we have no idea what a layer + * change does to view visibility on any output. + * + * For example, minimizing a window might move the view to a + * layer that's not part of the scene graph, and we'll no + * longer see that node in the paint node update loop, so + * won't know to damage its previously visible region. + */ + weston_view_destroy_paint_nodes(view); weston_view_geometry_dirty_internal(view); }