aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-06-12 18:28:33 +0200
committerAlexander Orzechowski <alex@ozal.ski>2023-06-12 21:52:16 +0000
commitac426c0c2469cb0b3297f95c8508a052705bdf4a (patch)
tree3edc2efbd2285f5e487144c527bf5473e6e43962
parent4339c37f99aa311e300205a7d27c43e470ae93da (diff)
examples/output-layers: fix layers not included in commit
wlr_output_set_layers() attaches layers to the output's pending state, but then uses a detached wlr_output_state in wlr_output_state_commit(). This results in layers being left out of the committed state. Fixes: 8e81b4bb4237 ("examples: convert to new rendering API")
-rw-r--r--examples/output-layers.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/output-layers.c b/examples/output-layers.c
index d4a45d5b..535b9f5f 100644
--- a/examples/output-layers.c
+++ b/examples/output-layers.c
@@ -82,10 +82,13 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
};
}
- wlr_output_set_layers(output->wlr_output, layers_arr.data,
- layers_arr.size / sizeof(struct wlr_output_layer_state));
+ struct wlr_output_state output_state = {
+ .committed = WLR_OUTPUT_STATE_LAYERS,
+ .layers = layers_arr.data,
+ .layers_len = layers_arr.size / sizeof(struct wlr_output_layer_state),
+ };
- if (!wlr_output_test(output->wlr_output)) {
+ if (!wlr_output_test_state(output->wlr_output, &output_state)) {
wlr_log(WLR_ERROR, "wlr_output_test() failed");
return;
}
@@ -93,7 +96,6 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
int width, height;
wlr_output_effective_resolution(output->wlr_output, &width, &height);
- struct wlr_output_state output_state = {0};
struct wlr_render_pass *pass = wlr_output_begin_render_pass(output->wlr_output, &output_state,
NULL, NULL);