From 060df4c6c0f92e3989ce6fa13e5862bb3bee7dae Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Mon, 7 Nov 2022 20:00:44 +0300 Subject: [PATCH] scene: introduce wlr_scene_buffer.events.outputs_update This event is useful for e.g. sending the preferred buffer scale to the client. --- include/wlr/types/wlr_scene.h | 1 + types/scene/wlr_scene.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h index e45a3ee0..e3e56cf7 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -131,6 +131,7 @@ struct wlr_scene_buffer { struct wlr_buffer *buffer; struct { + struct wl_signal outputs_update; struct wl_signal output_enter; // struct wlr_scene_output struct wl_signal output_leave; // struct wlr_scene_output struct wl_signal output_present; // struct wlr_scene_output diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index e9857dc3..04fa292f 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -370,6 +370,8 @@ static void update_node_update_outputs(struct wlr_scene_node *node, // if there are active outputs on this node, we should always have a primary // output assert(!scene_buffer->active_outputs || scene_buffer->primary_output); + + wl_signal_emit_mutable(&scene_buffer->events.outputs_update, NULL); } static bool scene_node_update_iterator(struct wlr_scene_node *node, @@ -548,6 +550,7 @@ struct wlr_scene_buffer *wlr_scene_buffer_create(struct wlr_scene_tree *parent, scene_buffer->buffer = wlr_buffer_lock(buffer); } + wl_signal_init(&scene_buffer->events.outputs_update); wl_signal_init(&scene_buffer->events.output_enter); wl_signal_init(&scene_buffer->events.output_leave); wl_signal_init(&scene_buffer->events.output_present);