diff options
author | Simon Ser <contact@emersion.fr> | 2022-05-24 20:41:22 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-05-30 11:34:57 +0200 |
commit | b21c26a1c9b5f035eb69ede201980c82c256dabc (patch) | |
tree | 8fde9c3fbdd4f9a4939ea4284171f9e82163fa23 | |
parent | c4253fef9c1197a4f1228022ca528f38b23b5519 (diff) |
output: add wlr_output_event_precommit.state
-rw-r--r-- | include/wlr/types/wlr_output.h | 1 | ||||
-rw-r--r-- | types/output/output.c | 1 | ||||
-rw-r--r-- | types/wlr_output_damage.c | 4 | ||||
-rw-r--r-- | types/wlr_screencopy_v1.c | 13 |
4 files changed, 13 insertions, 6 deletions
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 363df2bc..05275156 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -205,6 +205,7 @@ struct wlr_output_event_damage { struct wlr_output_event_precommit { struct wlr_output *output; struct timespec *when; + const struct wlr_output_state *state; }; struct wlr_output_event_commit { diff --git a/types/output/output.c b/types/output/output.c index 4bd4917a..a587edc1 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -703,6 +703,7 @@ bool wlr_output_commit(struct wlr_output *output) { struct wlr_output_event_precommit pre_event = { .output = output, .when = &now, + .state = &output->pending, }; wlr_signal_emit_safe(&output->events.precommit, &pre_event); diff --git a/types/wlr_output_damage.c b/types/wlr_output_damage.c index f9aabc31..0dfc30ca 100644 --- a/types/wlr_output_damage.c +++ b/types/wlr_output_damage.c @@ -47,9 +47,11 @@ static void output_handle_frame(struct wl_listener *listener, void *data) { static void output_handle_precommit(struct wl_listener *listener, void *data) { struct wlr_output_damage *output_damage = wl_container_of(listener, output_damage, output_precommit); + const struct wlr_output_event_precommit *event = data; + const struct wlr_output_state *state = event->state; struct wlr_output *output = output_damage->output; - if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { + if (state->committed & WLR_OUTPUT_STATE_BUFFER) { // TODO: find a better way to access this info without a precommit // handler output_damage->pending_attach_render = output->back_buffer != NULL; diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c index c656a916..0b48fe3f 100644 --- a/types/wlr_screencopy_v1.c +++ b/types/wlr_screencopy_v1.c @@ -40,16 +40,18 @@ static struct screencopy_damage *screencopy_damage_find( return NULL; } -static void screencopy_damage_accumulate(struct screencopy_damage *damage) { +static void screencopy_damage_accumulate(struct screencopy_damage *damage, + const struct wlr_output_state *state) { struct pixman_region32 *region = &damage->damage; struct wlr_output *output = damage->output; - if (output->pending.committed & WLR_OUTPUT_STATE_DAMAGE) { + if (state->committed & WLR_OUTPUT_STATE_DAMAGE) { // If the compositor submitted damage, copy it over - pixman_region32_union(region, region, &output->pending.damage); + pixman_region32_union(region, region, + (pixman_region32_t *) &state->damage); pixman_region32_intersect_rect(region, region, 0, 0, output->width, output->height); - } else if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { + } else if (state->committed & WLR_OUTPUT_STATE_BUFFER) { // If the compositor did not submit damage but did submit a buffer // damage everything pixman_region32_union_rect(region, region, 0, 0, @@ -61,7 +63,8 @@ static void screencopy_damage_handle_output_precommit( struct wl_listener *listener, void *data) { struct screencopy_damage *damage = wl_container_of(listener, damage, output_precommit); - screencopy_damage_accumulate(damage); + const struct wlr_output_event_precommit *event = data; + screencopy_damage_accumulate(damage, event->state); } static void screencopy_damage_destroy(struct screencopy_damage *damage) { |