summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <[email protected]>2022-06-29 21:10:08 +0300
committerKirill Primak <[email protected]>2022-06-29 21:19:38 +0300
commit9e9d0420728b21de04faacf799af0179397eb8f3 (patch)
tree394d2e89c69c5f2e9d96941f3f0c54599365890d
parentdfc28c46d99cdd49ca24f49744ce53e711ce2e3f (diff)
scene: add missing output damage listener
This is necessary to handle damage coming from the backend and software cursors.
-rw-r--r--wlr_scene.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/wlr_scene.c b/wlr_scene.c
index 0b127e6..a6328a3 100644
--- a/wlr_scene.c
+++ b/wlr_scene.c
@@ -1001,6 +1001,15 @@ static void scene_output_handle_mode(struct wl_listener *listener, void *data) {
scene_output_update_geometry(scene_output);
}
+static void scene_output_handle_damage(struct wl_listener *listener, void *data) {
+ struct wlr_scene_output *scene_output = wl_container_of(listener,
+ scene_output, output_damage);
+ struct wlr_output_event_damage *event = data;
+ if (wlr_damage_ring_add(&scene_output->damage_ring, event->damage)) {
+ wlr_output_schedule_frame(scene_output->output);
+ }
+}
+
static void scene_output_handle_needs_frame(struct wl_listener *listener, void *data) {
struct wlr_scene_output *scene_output = wl_container_of(listener,
scene_output, output_needs_frame);
@@ -1045,6 +1054,9 @@ struct wlr_scene_output *wlr_scene_output_create(struct wlr_scene *scene,
scene_output->output_mode.notify = scene_output_handle_mode;
wl_signal_add(&output->events.mode, &scene_output->output_mode);
+ scene_output->output_damage.notify = scene_output_handle_damage;
+ wl_signal_add(&output->events.damage, &scene_output->output_damage);
+
scene_output->output_needs_frame.notify = scene_output_handle_needs_frame;
wl_signal_add(&output->events.needs_frame, &scene_output->output_needs_frame);
@@ -1067,6 +1079,7 @@ void wlr_scene_output_destroy(struct wlr_scene_output *scene_output) {
wl_list_remove(&scene_output->link);
wl_list_remove(&scene_output->output_commit.link);
wl_list_remove(&scene_output->output_mode.link);
+ wl_list_remove(&scene_output->output_damage.link);
wl_list_remove(&scene_output->output_needs_frame.link);
free(scene_output);