diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2022-05-31 21:44:10 +0300 |
---|---|---|
committer | Isaac Freund <mail@isaacfreund.com> | 2022-06-01 09:49:25 +0000 |
commit | 1284f85da4ee9345af31d239a2e451c4066e710b (patch) | |
tree | de921852e0b0b4a2858370e6f60b55caf97a7a99 | |
parent | 0c2eed533eeb6a8d7dbe0a0378930b3a01be557d (diff) |
scene/output-layout: add initial outputs
-rw-r--r-- | types/scene/output_layout.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/types/scene/output_layout.c b/types/scene/output_layout.c index 21223114..900cabc3 100644 --- a/types/scene/output_layout.c +++ b/types/scene/output_layout.c @@ -72,12 +72,8 @@ static void scene_output_layout_handle_layout_change( } } -static void scene_output_layout_handle_layout_add( - struct wl_listener *listener, void *data) { - struct wlr_scene_output_layout *sol = - wl_container_of(listener, sol, layout_add); - struct wlr_output_layout_output *lo = data; - +static void scene_output_layout_add(struct wlr_scene_output_layout *sol, + struct wlr_output_layout_output *lo) { struct wlr_scene_output_layout_output *solo = calloc(1, sizeof(*solo)); if (solo == NULL) { return; @@ -105,6 +101,15 @@ static void scene_output_layout_handle_layout_add( wlr_scene_output_set_position(solo->scene_output, lo->x, lo->y); } +static void scene_output_layout_handle_layout_add( + struct wl_listener *listener, void *data) { + struct wlr_scene_output_layout *sol = + wl_container_of(listener, sol, layout_add); + struct wlr_output_layout_output *lo = data; + + scene_output_layout_add(sol, lo); +} + static void scene_output_layout_handle_layout_destroy( struct wl_listener *listener, void *data) { struct wlr_scene_output_layout *sol = @@ -143,5 +148,10 @@ bool wlr_scene_attach_output_layout(struct wlr_scene *scene, sol->scene_destroy.notify = scene_output_layout_handle_scene_destroy; wl_signal_add(&scene->tree.node.events.destroy, &sol->scene_destroy); + struct wlr_output_layout_output *lo; + wl_list_for_each(lo, &output_layout->outputs, link) { + scene_output_layout_add(sol, lo); + } + return true; } |