scene_graph: Maintain wlr_scene_nodes for the sway tree.

This commit is contained in:
Alexander Orzechowski 2024-01-18 10:00:45 -05:00 committed by Kirill Primak
parent dbd2fbf430
commit 1eb16d1367
13 changed files with 290 additions and 9 deletions

View file

@ -856,9 +856,6 @@ void output_damage_whole_container(struct sway_output *output,
.height = con->current.height + 2,
};
scale_box(&box, output->wlr_output->scale);
if (wlr_damage_ring_add_box(&output->damage_ring, &box)) {
wlr_output_schedule_frame(output->wlr_output);
}
// Damage subsurfaces as well, which may extend outside the box
if (con->view) {
damage_child_views_iterator(con, output);
@ -914,6 +911,8 @@ static void begin_destroy(struct sway_output *output) {
wlr_damage_ring_finish(&output->damage_ring);
wlr_scene_output_destroy(output->scene_output);
output->scene_output = NULL;
output->wlr_output->data = NULL;
output->wlr_output = NULL;
@ -1039,11 +1038,24 @@ void handle_new_output(struct wl_listener *listener, void *data) {
return;
}
struct sway_output *output = output_create(wlr_output);
if (!output) {
// Create the scene output here so we're not accidentally creating one for
// the fallback output
struct wlr_scene_output *scene_output =
wlr_scene_output_create(root->root_scene, wlr_output);
if (!scene_output) {
sway_log(SWAY_ERROR, "Failed to create a scene output");
return;
}
struct sway_output *output = output_create(wlr_output);
if (!output) {
sway_log(SWAY_ERROR, "Failed to create a sway output");
wlr_scene_output_destroy(scene_output);
return;
}
output->server = server;
output->scene_output = scene_output;
wlr_damage_ring_init(&output->damage_ring);
wl_signal_add(&root->output_layout->events.destroy, &output->layout_destroy);