From 3a997b74542ead7799248e06a957e0b8a1959bcd Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Thu, 4 Jul 2024 12:46:27 -0400 Subject: [PATCH] wlr_scene: Keep track of all surfaces for subsurface_tree --- include/wlr/types/wlr_scene.h | 4 ++++ types/scene/subsurface_tree.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h index 85587a380..c1b4b6345 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -133,6 +133,10 @@ struct wlr_scene_surface { struct wlr_scene_subsurface_tree { struct wlr_scene_tree *tree; + + // private state + + struct wl_list surfaces; }; /** A scene-graph node displaying a solid-colored rectangle */ diff --git a/types/scene/subsurface_tree.c b/types/scene/subsurface_tree.c index c165ece87..e7ba5bbb0 100644 --- a/types/scene/subsurface_tree.c +++ b/types/scene/subsurface_tree.c @@ -28,6 +28,7 @@ struct wlr_scene_subsurface_tree_surface { struct wlr_addon scene_addon; struct wlr_box clip; + struct wl_list link; // Only valid if the surface is a sub-surface @@ -52,6 +53,7 @@ static void subsurface_tree_addon_destroy(struct wlr_addon *addon) { wl_list_remove(&subsurface_tree->surface_map.link); wl_list_remove(&subsurface_tree->surface_unmap.link); wl_list_remove(&subsurface_tree->surface_new_subsurface.link); + wl_list_remove(&subsurface_tree->link); free(subsurface_tree); } @@ -276,6 +278,7 @@ static struct wlr_scene_subsurface_tree_surface *scene_surface_tree_create_surfa } } + wl_list_insert(&tree->surfaces, &subsurface_tree->link); subsurface_tree_reconfigure(subsurface_tree); wlr_addon_init(&subsurface_tree->scene_addon, &subsurface_tree->tree->node.addons, @@ -316,6 +319,8 @@ struct wlr_scene_subsurface_tree *wlr_scene_subsurface_tree_create( return NULL; } + wl_list_init(&subsurface_tree->surfaces); + struct wlr_scene_subsurface_tree_surface *subsurface_tree_surface = scene_surface_tree_create_surface(subsurface_tree, parent, surface); if (subsurface_tree_surface == NULL) {