types/scene: split wlr_scene into modular components

Refactor the scene graph implementation by splitting wlr_scene.c
into multiple focused units: buffer, node, rect and tree. Introduce
corresponding public headers for each component.

This reduces the size and complexity of the core scene file, improves
code organization and makes individual parts of the scene graph easier
to maintain and extend.

As part of this refactor, drop unnecessary pointer indirection when
passing scene trees (e.g. &scene->tree → scene->tree) and update all
call sites accordingly.

No functional changes intended.
This commit is contained in:
YaoBing Xiao 2026-04-26 21:55:22 +08:00
parent b806de1d8c
commit 04501f8d8b
21 changed files with 2970 additions and 1999 deletions

View file

@ -12,6 +12,7 @@
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_scene_rect.h>
#include <wlr/types/wlr_xdg_shell.h>
#include <wlr/util/log.h>
@ -131,12 +132,12 @@ static void server_handle_new_surface(struct wl_listener *listener,
wl_signal_add(&wlr_surface->events.destroy, &surface->destroy);
/* Border dimensions will be set in surface.commit handler */
surface->border = wlr_scene_rect_create(&server->scene->tree,
surface->border = wlr_scene_rect_create(server->scene->tree,
0, 0, (float[4]){ 0.5f, 0.5f, 0.5f, 1 });
wlr_scene_node_set_position(&surface->border->node, pos, pos);
surface->scene_surface =
wlr_scene_surface_create(&server->scene->tree, wlr_surface);
wlr_scene_surface_create(server->scene->tree, wlr_surface);
wlr_scene_node_set_position(&surface->scene_surface->buffer->node,
pos + border_width, pos + border_width);