scene: inline subsurface_tree_destroy

This is only called from one function.

To destroy the wlr_scene_subsurface_tree from elsewhere, callers
can destroy the scene-graph node returned by
wlr_scene_subsurface_tree_create instead (just like a compositor
would do). subsurface_tree_handle_surface_destroy does exactly this.

Inlining avoids calling subsurface_tree_destroy by mistake.
This commit is contained in:
Simon Ser 2021-10-27 15:42:08 +02:00 committed by Isaac Freund
parent a92293a15a
commit a80f2b2816

View file

@ -22,7 +22,10 @@ struct wlr_scene_subsurface_tree {
struct wl_listener surface_new_subsurface; struct wl_listener surface_new_subsurface;
}; };
static void subsurface_tree_destroy(struct wlr_scene_subsurface_tree *subsurface_tree) { static void subsurface_tree_handle_tree_destroy(struct wl_listener *listener,
void *data) {
struct wlr_scene_subsurface_tree *subsurface_tree =
wl_container_of(listener, subsurface_tree, tree_destroy);
// tree and scene_surface will be cleaned up by scene_node_finish // tree and scene_surface will be cleaned up by scene_node_finish
if (subsurface_tree->parent) { if (subsurface_tree->parent) {
wlr_addon_finish(&subsurface_tree->surface_addon); wlr_addon_finish(&subsurface_tree->surface_addon);
@ -34,13 +37,6 @@ static void subsurface_tree_destroy(struct wlr_scene_subsurface_tree *subsurface
free(subsurface_tree); free(subsurface_tree);
} }
static void subsurface_tree_handle_tree_destroy(struct wl_listener *listener,
void *data) {
struct wlr_scene_subsurface_tree *subsurface_tree =
wl_container_of(listener, subsurface_tree, tree_destroy);
subsurface_tree_destroy(subsurface_tree);
}
static void subsurface_tree_handle_surface_destroy(struct wl_listener *listener, static void subsurface_tree_handle_surface_destroy(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_scene_subsurface_tree *subsurface_tree = struct wlr_scene_subsurface_tree *subsurface_tree =