Fix layer surface damage not being extended if using effects (#160)
This commit is contained in:
parent
d2ad352c7f
commit
c4a0bb268a
|
@ -334,6 +334,13 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
|||
bool extent_changed =
|
||||
memcmp(&old_extent, &layer->extent, sizeof(struct wlr_box)) != 0;
|
||||
if (extent_changed || layer_changed) {
|
||||
int blur_size = layer->has_blur? config_get_blur_size(): 0;
|
||||
int shadow_sigma = layer->has_shadow? config->shadow_blur_sigma: 0;
|
||||
int effect_size = MAX(blur_size, shadow_sigma);
|
||||
old_extent.x -= effect_size;
|
||||
old_extent.y -= effect_size;
|
||||
old_extent.width += effect_size * 2;
|
||||
old_extent.height += effect_size * 2;
|
||||
output_damage_box(output, &old_extent);
|
||||
output_damage_surface(output, layer->geo.x, layer->geo.y,
|
||||
layer_surface->surface, true);
|
||||
|
|
|
@ -697,9 +697,19 @@ static void damage_surface_iterator(struct sway_output *output,
|
|||
}
|
||||
pixman_region32_translate(&damage, box.x, box.y);
|
||||
|
||||
if (view) {
|
||||
int blur_size = view->container->blur_enabled ? config_get_blur_size() : 0;
|
||||
|
||||
// Extend view/layer damage size
|
||||
int effect_size = 0;
|
||||
if (view && view->container->blur_enabled) {
|
||||
// Don't check for shadow, gets extended in `output_damage_whole_container`
|
||||
effect_size = config_get_blur_size();
|
||||
} else if (wlr_surface_is_layer_surface(surface)) {
|
||||
struct wlr_layer_surface_v1 *layer = wlr_layer_surface_v1_from_wlr_surface(surface);
|
||||
struct sway_layer_surface *sway_layer = layer_from_wlr_layer_surface_v1(layer);
|
||||
int blur_size = sway_layer->has_blur? config_get_blur_size(): 0;
|
||||
int shadow_sigma = sway_layer->has_shadow? config->shadow_blur_sigma: 0;
|
||||
effect_size = MAX(blur_size, shadow_sigma);
|
||||
}
|
||||
if (effect_size > 0) {
|
||||
if (pixman_region32_not_empty(&damage)) {
|
||||
int output_width, output_height;
|
||||
wlr_output_transformed_resolution(output->wlr_output, &output_width, &output_height);
|
||||
|
@ -708,14 +718,13 @@ static void damage_surface_iterator(struct sway_output *output,
|
|||
if (damage_width > output_width || damage_height > output_height) {
|
||||
pixman_region32_intersect_rect(&damage, &damage, 0, 0, output_width, output_height);
|
||||
} else {
|
||||
wlr_region_expand(&damage, &damage, blur_size);
|
||||
wlr_region_expand(&damage, &damage, effect_size);
|
||||
}
|
||||
}
|
||||
|
||||
box.x -= blur_size;
|
||||
box.y -= blur_size;
|
||||
box.width += blur_size * 2;
|
||||
box.height += blur_size * 2;
|
||||
box.x -= effect_size;
|
||||
box.y -= effect_size;
|
||||
box.width += effect_size * 2;
|
||||
box.height += effect_size * 2;
|
||||
}
|
||||
|
||||
if (wlr_damage_ring_add(&output->damage_ring, &damage)) {
|
||||
|
|
Loading…
Reference in a new issue