From 304c61307aa012139a5cf4704e3dcbf22c29cc33 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sat, 22 Jan 2022 11:35:22 +0300 Subject: [PATCH] compositor: damage the whole buffer on viewport src change wp_viewporter protocol doesn't seem to say anything about damage, but Firefox assumes that wp_viewport::set_source alone is enough to damage the whole surface, and that assumption kinda makes sense, so let's do that. (cherry picked from commit da2491d4163e1d8e627d00c8ae594c7f8003472e) --- types/wlr_surface.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/types/wlr_surface.c b/types/wlr_surface.c index d5d49571..6a0992fe 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -207,8 +207,12 @@ static void surface_update_damage(pixman_region32_t *buffer_damage, pixman_region32_clear(buffer_damage); if (pending->width != current->width || - pending->height != current->height) { - // Damage the whole buffer on resize + pending->height != current->height || + pending->viewport.src.x != current->viewport.src.x || + pending->viewport.src.y != current->viewport.src.y || + pending->viewport.src.width != current->viewport.src.width || + pending->viewport.src.height != current->viewport.src.height) { + // Damage the whole buffer on resize or viewport source box change pixman_region32_union_rect(buffer_damage, buffer_damage, 0, 0, pending->buffer_width, pending->buffer_height); } else { @@ -491,7 +495,7 @@ static void collect_subsurface_damage_iter(struct wlr_surface *surface, static void subsurface_parent_commit(struct wlr_subsurface *subsurface) { struct wlr_surface *surface = subsurface->surface; - + bool moved = subsurface->current.x != subsurface->pending.x || subsurface->current.y != subsurface->pending.y; if (subsurface->mapped && moved) {