aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gilg <subdiff@gmail.com>2022-02-20 17:47:15 +0100
committerSimon Ser <contact@emersion.fr>2022-02-21 15:58:29 +0000
commitcff4abc5b15f2303a6e754b3e4bacd2bdef5811e (patch)
treebeed7d718b0fb78f0bbe80016323327c9989dede
parentdb6661502da7c6574d94d8f94a6d0f847fe10188 (diff)
output: clear buffer created for test
When calling wlr_output_test an empty buffer might be created. This implicitly changes the pending state of the output. Ensure that such a change is only temporarily and clear such an empty buffer before returning the test result.
-rw-r--r--types/output/output.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/types/output/output.c b/types/output/output.c
index 0062013f..1c0241fe 100644
--- a/types/output/output.c
+++ b/types/output/output.c
@@ -639,6 +639,9 @@ static bool output_basic_test(struct wlr_output *output) {
}
bool wlr_output_test(struct wlr_output *output) {
+ bool had_buffer = output->pending.committed & WLR_OUTPUT_STATE_BUFFER;
+ bool success;
+
if (!output_basic_test(output)) {
return false;
}
@@ -648,7 +651,13 @@ bool wlr_output_test(struct wlr_output *output) {
if (!output->impl->test) {
return true;
}
- return output->impl->test(output);
+
+ success = output->impl->test(output);
+
+ if (!had_buffer) {
+ output_clear_back_buffer(output);
+ }
+ return success;
}
bool wlr_output_commit(struct wlr_output *output) {