From d8c20ddac2a58bf3256ed77881b94030211fa080 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 12 Dec 2019 23:22:18 +0100 Subject: [PATCH] Don't re-use prev alloc on composition layer change --- include/private.h | 3 ++- output.c | 3 +++ test/meson.build | 1 + test/test_dynamic.c | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/private.h b/include/private.h index 0bcd154..abd0040 100644 --- a/include/private.h +++ b/include/private.h @@ -30,7 +30,8 @@ struct liftoff_output { struct liftoff_layer *composition_layer; struct liftoff_list layers; /* liftoff_layer.link */ - bool layers_changed; /* layer added or removed */ + /* layer added or removed, or composition layer changed */ + bool layers_changed; }; struct liftoff_layer { diff --git a/output.c b/output.c index 462f103..7b1b372 100644 --- a/output.c +++ b/output.c @@ -44,5 +44,8 @@ void liftoff_output_set_composition_layer(struct liftoff_output *output, struct liftoff_layer *layer) { assert(layer->output == output); + if (layer != output->composition_layer) { + output->layers_changed = true; + } output->composition_layer = layer; } diff --git a/test/meson.build b/test/meson.build index e8df7cf..e4727cf 100644 --- a/test/meson.build +++ b/test/meson.build @@ -47,6 +47,7 @@ tests = { 'fb', 'add-layer', 'remove-layer', + 'change-composition-layer', ], 'priority': [ #'basic', diff --git a/test/test_dynamic.c b/test/test_dynamic.c index 7532425..c960075 100644 --- a/test/test_dynamic.c +++ b/test/test_dynamic.c @@ -91,6 +91,9 @@ int main(int argc, char *argv[]) { liftoff_layer_destroy(other_layer); other_layer = NULL; want_reuse_prev_alloc = false; + } else if (strcmp(test_name, "change-composition-layer") == 0) { + liftoff_output_set_composition_layer(output, layer); + want_reuse_prev_alloc = false; } else { fprintf(stderr, "no such test: %s\n", test_name); return 1;