scene_graph: Maintain wlr_scene_nodes for the sway tree.

This commit is contained in:
Alexander Orzechowski 2022-08-31 23:42:15 -04:00 committed by Kirill Primak
parent a33ede4c43
commit 25da7b237d
13 changed files with 286 additions and 6 deletions

View file

@ -791,6 +791,8 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
wl_list_remove(&output->mode.link);
wl_list_remove(&output->present.link);
wlr_scene_output_destroy(output->scene_output);
output->scene_output = NULL;
output->wlr_output->data = NULL;
output->wlr_output = NULL;
@ -898,11 +900,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;
output->damage = wlr_output_damage_create(wlr_output);
wl_signal_add(&wlr_output->events.destroy, &output->destroy);