diff options
author | 2019-03-08 12:44:42 -0500 | |
---|---|---|
committer | 2019-03-10 01:20:36 +0100 | |
commit | 7580718d12ed752ed5565e28ce3d46c3a589ffe3 (patch) | |
tree | 580a2d72afadba2463d7771e130ae6569b85ded5 /sway | |
parent | fix "directive argument is null" errors (diff) | |
download | sway-7580718d12ed752ed5565e28ce3d46c3a589ffe3.tar.gz sway-7580718d12ed752ed5565e28ce3d46c3a589ffe3.tar.zst sway-7580718d12ed752ed5565e28ce3d46c3a589ffe3.zip |
output_damage_whole_container: damage subsurfaces
This adds an iterative call in `output_damage_whole_container` to
damage the subsurfaces for all visible views that are inside of the
container. This is needed to damage subsurfaces that extend outside the
box of the container. Without this, those subsurfaces will create
artifacts when moving or resizing.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/output.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index d7d3fc07..54b9f294 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -473,6 +473,17 @@ void output_damage_box(struct sway_output *output, struct wlr_box *_box) { | |||
473 | wlr_output_damage_add_box(output->damage, &box); | 473 | wlr_output_damage_add_box(output->damage, &box); |
474 | } | 474 | } |
475 | 475 | ||
476 | static void damage_child_views_iterator(struct sway_container *con, | ||
477 | void *data) { | ||
478 | if (!con->view || !view_is_visible(con->view)) { | ||
479 | return; | ||
480 | } | ||
481 | struct sway_output *output = data; | ||
482 | bool whole = true; | ||
483 | output_view_for_each_surface(output, con->view, damage_surface_iterator, | ||
484 | &whole); | ||
485 | } | ||
486 | |||
476 | void output_damage_whole_container(struct sway_output *output, | 487 | void output_damage_whole_container(struct sway_output *output, |
477 | struct sway_container *con) { | 488 | struct sway_container *con) { |
478 | // Pad the box by 1px, because the width is a double and might be a fraction | 489 | // Pad the box by 1px, because the width is a double and might be a fraction |
@@ -484,6 +495,12 @@ void output_damage_whole_container(struct sway_output *output, | |||
484 | }; | 495 | }; |
485 | scale_box(&box, output->wlr_output->scale); | 496 | scale_box(&box, output->wlr_output->scale); |
486 | wlr_output_damage_add_box(output->damage, &box); | 497 | wlr_output_damage_add_box(output->damage, &box); |
498 | // Damage subsurfaces as well, which may extend outside the box | ||
499 | if (con->view) { | ||
500 | damage_child_views_iterator(con, output); | ||
501 | } else { | ||
502 | container_for_each_child(con, damage_child_views_iterator, output); | ||
503 | } | ||
487 | } | 504 | } |
488 | 505 | ||
489 | static void damage_handle_destroy(struct wl_listener *listener, void *data) { | 506 | static void damage_handle_destroy(struct wl_listener *listener, void *data) { |