From e037e7475642aa8259012fd5458e718660db65b8 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Thu, 10 Oct 2019 21:40:22 +0000 Subject: [PATCH] Implement screencopy damage --- include/screencopy.h | 7 +++++++ src/main.c | 10 ++++++++-- src/screencopy.c | 7 +++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/include/screencopy.h b/include/screencopy.h index ce12322..e821837 100644 --- a/include/screencopy.h +++ b/include/screencopy.h @@ -36,6 +36,13 @@ struct screencopy { uint32_t height; uint32_t stride; + struct { + uint32_t x; + uint32_t y; + uint32_t width; + uint32_t height; + } damage; + void* userdata; }; diff --git a/src/main.c b/src/main.c index 74efdd5..a45084c 100644 --- a/src/main.c +++ b/src/main.c @@ -388,8 +388,14 @@ void wayvnc_update_vnc(struct wayvnc* self, struct nvnc_fb* fb) self->current_fb = fb; if (self->last_fb) { - nvnc_check_damage(self->current_fb, self->last_fb, 0, 0, - width, height, on_damage_check_done, self); + uint32_t hint_x = self->screencopy_backend.damage.x; + uint32_t hint_y = self->screencopy_backend.damage.y; + uint32_t hint_width = self->screencopy_backend.damage.width; + uint32_t hint_height = self->screencopy_backend.damage.height; + + nvnc_check_damage(self->current_fb, self->last_fb, hint_x, + hint_y, hint_width, hint_height, + on_damage_check_done, self); return; } diff --git a/src/screencopy.c b/src/screencopy.c index 6bc49ab..1c70ca7 100644 --- a/src/screencopy.c +++ b/src/screencopy.c @@ -92,7 +92,7 @@ static void screencopy_buffer(void* data, self->height = height; self->stride = stride; - zwlr_screencopy_frame_v1_copy(self->frame, self->buffer); + zwlr_screencopy_frame_v1_copy_with_damage(self->frame, self->buffer); } static void screencopy_flags(void* data, @@ -136,7 +136,10 @@ static void screencopy_damage(void* data, { struct screencopy* self = data; - /* TODO */ + self->damage.x = x; + self->damage.y = y; + self->damage.width = width; + self->damage.height = height; } int screencopy_start(struct screencopy* self)