output_damage: listen to transform and scale output events

master
emersion 7 years ago
parent 5a8f098eea
commit a9632341bf
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -1,7 +1,9 @@
#ifndef WLR_TYPES_WLR_OUTPUT_DAMAGE_H
#define WLR_TYPES_WLR_OUTPUT_DAMAGE_H
#include <time.h>
#include <pixman.h>
#include <wlr/types/wlr_output.h>
/**
* 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;
};

@ -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);

Loading…
Cancel
Save