aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-02-11 13:07:00 +0100
committeremersion <contact@emersion.fr>2018-02-11 13:07:00 +0100
commita9632341bfcb1e0a172d93c4fd331291a842332c (patch)
tree0162715f2f4c8ca489f8417e6c934ef1d990099e
parent5a8f098eea1637213d29a6ec831bcebc11c92aaa (diff)
output_damage: listen to transform and scale output events
-rw-r--r--include/wlr/types/wlr_output_damage.h4
-rw-r--r--types/wlr_output_damage.c18
2 files changed, 22 insertions, 0 deletions
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 <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;
};
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);