diff --git a/types/wlr_output_damage.c b/types/wlr_output_damage.c index 08a2baaa..6d24a4bf 100644 --- a/types/wlr_output_damage.c +++ b/types/wlr_output_damage.c @@ -61,31 +61,30 @@ static void output_handle_commit(struct wl_listener *listener, void *data) { wl_container_of(listener, output_damage, output_commit); struct wlr_output_event_commit *event = data; - if (event->committed & (WLR_OUTPUT_STATE_SCALE | WLR_OUTPUT_STATE_TRANSFORM)) { - wlr_output_damage_add_whole(output_damage); - } + if (event->committed & WLR_OUTPUT_STATE_BUFFER) { + pixman_region32_t *prev; + if (output_damage->pending_attach_render) { + // render-buffers have been swapped, rotate the damage + + // same as decrementing, but works on unsigned integers + output_damage->previous_idx += WLR_OUTPUT_DAMAGE_PREVIOUS_LEN - 1; + output_damage->previous_idx %= WLR_OUTPUT_DAMAGE_PREVIOUS_LEN; + + prev = &output_damage->previous[output_damage->previous_idx]; + pixman_region32_copy(prev, &output_damage->current); + } else { + // accumulate render-buffer damage + prev = &output_damage->previous[output_damage->previous_idx]; + pixman_region32_union(prev, prev, &output_damage->current); + } - if (!(event->committed & WLR_OUTPUT_STATE_BUFFER)) { - return; + pixman_region32_clear(&output_damage->current); } - pixman_region32_t *prev; - if (output_damage->pending_attach_render) { - // render-buffers have been swapped, rotate the damage - - // same as decrementing, but works on unsigned integers - output_damage->previous_idx += WLR_OUTPUT_DAMAGE_PREVIOUS_LEN - 1; - output_damage->previous_idx %= WLR_OUTPUT_DAMAGE_PREVIOUS_LEN; - - prev = &output_damage->previous[output_damage->previous_idx]; - pixman_region32_copy(prev, &output_damage->current); - } else { - // accumulate render-buffer damage - prev = &output_damage->previous[output_damage->previous_idx]; - pixman_region32_union(prev, prev, &output_damage->current); + if (event->committed & (WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_SCALE | + WLR_OUTPUT_STATE_TRANSFORM)) { + wlr_output_damage_add_whole(output_damage); } - - pixman_region32_clear(&output_damage->current); } struct wlr_output_damage *wlr_output_damage_create(struct wlr_output *output) {