aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-02-21 18:34:11 +0100
committerAlexander Orzechowski <alex@ozal.ski>2023-03-10 11:16:01 +0000
commit1b6fac4aa6d1038f64f771e6ffbe01b90bb967e5 (patch)
treebfd9836735e2a11f477ddfbfe073fda3e6166ed1
parent87969c1c7c6a85420456b2d6c075944c4b029840 (diff)
output-layer: require all layers in wlr_output_state.layers
- Simplifies the backends - Avoids having two ways to do the same thing: previously one could disable a layer by either omitting it from wlr_output_state.layers, or by passing a NULL buffer - We can change our mind in the future: we can allow users to omit some layers and define a meaning without breaking the API. References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4017#note_1783997
-rw-r--r--backend/wayland/output.c25
-rw-r--r--include/wlr/types/wlr_output_layer.h2
-rw-r--r--types/output/output.c5
3 files changed, 7 insertions, 25 deletions
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index 7d2fdb34..3f16388d 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -399,31 +399,6 @@ static bool commit_layers(struct wlr_wl_output *output,
}
}
- // Unmap any layer we haven't seen
- struct wlr_output_layer *wlr_layer;
- wl_list_for_each(wlr_layer, &output->wlr_output.layers, link) {
- bool found = false;
- for (size_t i = 0; i < layers_len; i++) {
- if (layers[i].layer == wlr_layer) {
- found = true;
- break;
- }
- }
- if (found) {
- continue;
- }
-
- struct wlr_wl_output_layer *layer =
- get_or_create_output_layer(output, wlr_layer);
- if (layer == NULL) {
- continue;
- }
-
- // TODO: only do this once
- wl_surface_attach(layer->surface, NULL, 0, 0);
- wl_surface_commit(layer->surface);
- }
-
return true;
}
diff --git a/include/wlr/types/wlr_output_layer.h b/include/wlr/types/wlr_output_layer.h
index bd10fd12..1ba69c8f 100644
--- a/include/wlr/types/wlr_output_layer.h
+++ b/include/wlr/types/wlr_output_layer.h
@@ -36,6 +36,8 @@
* Callers are responsible for disabling output layers when they need the full
* output contents to be composited onto a single buffer, e.g. during screen
* capture.
+ *
+ * Callers must always include the state for all layers on output test/commit.
*/
struct wlr_output_layer {
struct wl_list link; // wlr_output.layers
diff --git a/types/output/output.c b/types/output/output.c
index 75defcc2..6d331b93 100644
--- a/types/output/output.c
+++ b/types/output/output.c
@@ -673,6 +673,11 @@ static bool output_basic_test(struct wlr_output *output,
}
if (state->committed & WLR_OUTPUT_STATE_LAYERS) {
+ if (state->layers_len != (size_t)wl_list_length(&output->layers)) {
+ wlr_log(WLR_DEBUG, "All output layers must be specified in wlr_output_state.layers");
+ return false;
+ }
+
for (size_t i = 0; i < state->layers_len; i++) {
state->layers[i].accepted = false;
}