From 4d6e7f510e80ecae25dff8f36cde77583f53ee8b Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 2 Feb 2018 20:34:46 +0100 Subject: rootston: fix artifacts when leaving fullscreen in a rotated view --- rootston/output.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'rootston') diff --git a/rootston/output.c b/rootston/output.c index a7fca415..294ad57a 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -542,10 +542,27 @@ static void damage_whole_surface(struct wlr_surface *surface, return; } - wlr_box_rotated_bounds(&box, -rotation, &box); + // Take the surface damage and damage the whole surface + // The surface damage is still useful in case the surface got resized + pixman_region32_t damage; + pixman_region32_init(&damage); + pixman_region32_copy(&damage, &surface->current->surface_damage); + wlr_region_scale(&damage, &damage, output->wlr_output->scale); + pixman_region32_union_rect(&damage, &damage, 0, 0, box.width, box.height); + pixman_region32_translate(&damage, box.x, box.y); + pixman_box32_t *extents = pixman_region32_extents(&damage); + struct wlr_box extents_box = { + .x = extents->x1, + .y = extents->y1, + .width = extents->x2 - extents->x1, + .height = extents->y2 - extents->y1, + }; + pixman_region32_fini(&damage); + + wlr_box_rotated_bounds(&extents_box, -rotation, &extents_box); pixman_region32_union_rect(&output->damage, &output->damage, - box.x, box.y, box.width, box.height); + extents_box.x, extents_box.y, extents_box.width, extents_box.height); wlr_output_schedule_frame(output->wlr_output); } -- cgit v1.2.3