From f12189a074159ae5eab7246dd7af5830dff21e77 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 9 Sep 2021 12:18:23 +0200 Subject: [PATCH] Use wlr_scene_attach_output_layout This provides wlr_output_layout integration. References: https://github.com/swaywm/wlroots/pull/3160 --- cage.c | 2 ++ output.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cage.c b/cage.c index ccf3b11..1717bcb 100644 --- a/cage.c +++ b/cage.c @@ -338,6 +338,8 @@ main(int argc, char *argv[]) goto end; } + wlr_scene_attach_output_layout(server.scene, server.output_layout); + compositor = wlr_compositor_create(server.wl_display, server.renderer); if (!compositor) { wlr_log(WLR_ERROR, "Unable to create the wlroots compositor"); diff --git a/output.c b/output.c index 5ab1ea3..1c39dd7 100644 --- a/output.c +++ b/output.c @@ -11,6 +11,7 @@ #include "config.h" +#include #include #include #include @@ -206,6 +207,15 @@ output_enable(struct cg_output *output) wlr_output_layout_add_auto(output->server->output_layout, wlr_output); wlr_output_enable(wlr_output, true); wlr_output_commit(wlr_output); + + struct wlr_scene_output *scene_output; + wl_list_for_each (scene_output, &output->server->scene->outputs, link) { + if (scene_output->output == wlr_output) { + output->scene_output = scene_output; + break; + } + } + assert(output->scene_output != NULL); } static void @@ -218,6 +228,8 @@ output_disable(struct cg_output *output) return; } + output->scene_output = NULL; + wlr_log(WLR_DEBUG, "Disabling output %s", wlr_output->name); wlr_output_enable(wlr_output, false); wlr_output_layout_remove(output->server->output_layout, wlr_output); @@ -343,7 +355,6 @@ handle_new_output(struct wl_listener *listener, void *data) output->wlr_output = wlr_output; output->server = server; - output->scene_output = wlr_scene_output_create(server->scene, wlr_output); wl_list_insert(&server->outputs, &output->link);