Commit Graph

11 Commits

Author SHA1 Message Date
Simon Ser 431e8a7fd7 scene: ignore duplicate wlr_scene_output_layout_add_output() calls
An assert was added in [1] to avoid tracking the same output multiple
times. However, this is cumbersome for compositors [2]: they need to
add a special check for this. Additionally, this is inconsistent with
wlr_output_layout_add().

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4380
[2]: https://github.com/cage-kiosk/cage/pull/315
2024-02-20 11:04:46 +01:00
Alexander Orzechowski 291431c14f scene/output_layout: Add assert for duplicate output insertion
Ensure that the output was not added multiple times to the scene
output layout.
2023-10-08 11:18:11 -04:00
Kirill Primak b06c2f3d1f scene-output-layout: assert lo->output == so->output 2023-10-08 13:11:29 +03:00
Alexander Orzechowski e1e911d425 scene_output_layout: Don't destroy output when output layout is destroyed
There were a couple of problems with this:
1. The behavior is unexpected. Typically objects in wlroots won't
also destroy objects that they depend on. For instance, wlr_scene_output
will not destroy the wlr_output when it's destroyed. It shouldn't be any
different for scene layouts.
2. This fixes a crash where because wlr_output_layout and wlr_scene_output
are both addons to wlr_output, we might get into a situation where
wl_list_for_each_safe might malfunction. See [1]

This means that the compositor needs to manually destroy the output
when they destroy the layout, hence ~breaking. Compositors can just
call `wlr_scene_output_destroy()` if they want to destroy both at the
same time.

[1] https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4358#note_2106260

This reverts commit 1a731596c5.

Co-authored-by: Kirill Primak <vyivel@eclair.cafe>
2023-10-07 13:31:20 -04:00
Rose Hudson f5917f0247 scene_output_layout: make output adding explicit
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3709
2023-08-22 11:53:28 +02:00
Consolatis 0173275f7e scene/output_layout: Fix crash in scene_output_layout_output_destroy
Closes: #3448
2022-06-07 20:58:41 +02:00
Kirill Primak 1284f85da4 scene/output-layout: add initial outputs 2022-06-01 09:49:25 +00:00
Kirill Primak 0c2eed533e scene/output-layout: improve ownership logic
This commit ensures that outputs that weren't created by the output
layout helper aren't destroyed on the output layout change.

Consider the following piece of logic:

// struct wlr_output *o1, *o2;
// struct wlr_scene *scene;
// struct wlr_output_layout *layout;
wlr_scene_attach_output_layout(scene, layout);
wlr_output_layout_add_auto(layout, o1);
struct wlr_scene_output *so2 = wlr_scene_output_create(scene, o2);
wlr_output_layout_move(layout, o1, 100, 200);
// so2 is invalid now
2022-06-01 09:49:25 +00:00
Alexander Orzechowski 9eb71146ae wlr_scene: Refactor wlr_scene (the root element) to encase a wlr_scene_tree
Co-authored-by: Isaac Freund <mail@isaacfreund.com>
2022-05-31 09:14:28 +00:00
Kirill Primak 4ba8458255 scene/output-layout: fix scene destroy handler 2022-04-14 06:51:39 +00:00
Simon Ser a181a37b12 scene: add wlr_scene_attach_output_layout
This is a helper to integrate wlr_scene with wlr_output_layout.
2021-09-09 12:04:35 +02:00