backend/wayland: commit null buffer only on unmap

If the guest compositor disabled an output and then immediately
committed another state, we would perform a commit with a null buffer,
which is against the protocol, as the host compositor expects an
initial commit with no buffer at all.
This commit is contained in:
Kirill Primak 2024-02-11 10:38:59 +03:00
parent baf1e4f674
commit d9f6498f8a

View File

@ -548,7 +548,9 @@ static bool output_commit(struct wlr_output *wlr_output,
return false; return false;
} }
if ((state->committed & WLR_OUTPUT_STATE_ENABLED) && !state->enabled) { bool pending_enabled = output_pending_enabled(wlr_output, state);
if (wlr_output->enabled && !pending_enabled) {
wl_surface_attach(output->surface, NULL, 0, 0); wl_surface_attach(output->surface, NULL, 0, 0);
wl_surface_commit(output->surface); wl_surface_commit(output->surface);
} }
@ -575,7 +577,7 @@ static bool output_commit(struct wlr_output *wlr_output,
return false; return false;
} }
if (output_pending_enabled(wlr_output, state)) { if (pending_enabled) {
if (output->frame_callback != NULL) { if (output->frame_callback != NULL) {
wl_callback_destroy(output->frame_callback); wl_callback_destroy(output->frame_callback);
} }