From a9632341bfcb1e0a172d93c4fd331291a842332c Mon Sep 17 00:00:00 2001 From: emersion Date: Sun, 11 Feb 2018 13:07:00 +0100 Subject: [PATCH] output_damage: listen to transform and scale output events --- include/wlr/types/wlr_output_damage.h | 4 ++++ types/wlr_output_damage.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/wlr/types/wlr_output_damage.h b/include/wlr/types/wlr_output_damage.h index ec5fcd0d..52cbce78 100644 --- a/include/wlr/types/wlr_output_damage.h +++ b/include/wlr/types/wlr_output_damage.h @@ -1,7 +1,9 @@ #ifndef WLR_TYPES_WLR_OUTPUT_DAMAGE_H #define WLR_TYPES_WLR_OUTPUT_DAMAGE_H +#include #include +#include /** * Damage tracking requires to keep track of previous frames' damage. To allow @@ -34,6 +36,8 @@ struct wlr_output_damage { struct wl_listener output_destroy; struct wl_listener output_mode; + struct wl_listener output_transform; + struct wl_listener output_scale; struct wl_listener output_needs_swap; struct wl_listener output_frame; }; diff --git a/types/wlr_output_damage.c b/types/wlr_output_damage.c index 741360ac..354314b6 100644 --- a/types/wlr_output_damage.c +++ b/types/wlr_output_damage.c @@ -18,6 +18,18 @@ static void output_handle_mode(struct wl_listener *listener, void *data) { wlr_output_damage_add_whole(output_damage); } +static void output_handle_transform(struct wl_listener *listener, void *data) { + struct wlr_output_damage *output_damage = + wl_container_of(listener, output_damage, output_transform); + wlr_output_damage_add_whole(output_damage); +} + +static void output_handle_scale(struct wl_listener *listener, void *data) { + struct wlr_output_damage *output_damage = + wl_container_of(listener, output_damage, output_scale); + wlr_output_damage_add_whole(output_damage); +} + static void output_handle_needs_swap(struct wl_listener *listener, void *data) { struct wlr_output_damage *output_damage = wl_container_of(listener, output_damage, output_needs_swap); @@ -57,6 +69,10 @@ struct wlr_output_damage *wlr_output_damage_create(struct wlr_output *output) { output_damage->output_destroy.notify = output_handle_destroy; wl_signal_add(&output->events.mode, &output_damage->output_mode); output_damage->output_mode.notify = output_handle_mode; + wl_signal_add(&output->events.transform, &output_damage->output_transform); + output_damage->output_transform.notify = output_handle_transform; + wl_signal_add(&output->events.scale, &output_damage->output_scale); + output_damage->output_scale.notify = output_handle_scale; wl_signal_add(&output->events.needs_swap, &output_damage->output_needs_swap); output_damage->output_needs_swap.notify = output_handle_needs_swap; wl_signal_add(&output->events.frame, &output_damage->output_frame); @@ -72,6 +88,8 @@ void wlr_output_damage_destroy(struct wlr_output_damage *output_damage) { wl_signal_emit(&output_damage->events.destroy, output_damage); wl_list_remove(&output_damage->output_destroy.link); wl_list_remove(&output_damage->output_mode.link); + wl_list_remove(&output_damage->output_transform.link); + wl_list_remove(&output_damage->output_scale.link); wl_list_remove(&output_damage->output_needs_swap.link); wl_list_remove(&output_damage->output_frame.link); pixman_region32_fini(&output_damage->current);