diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 367a173e..4d79cbe6 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -332,7 +332,7 @@ damage_finish: // _box.width and .height are expected to be output-buffer-local void render_box_shadow(struct sway_output *output, pixman_region32_t *output_damage, const struct wlr_box *_box, const float color[static 4], - float blur_sigma, float corner_radius) { + float blur_sigma, float corner_radius, float border_thickness) { struct wlr_output *wlr_output = output->wlr_output; struct fx_renderer *renderer = output->server->renderer; @@ -351,6 +351,9 @@ void render_box_shadow(struct sway_output *output, pixman_region32_t *output_dam box.width += 2 * blur_sigma; box.height += 2 * blur_sigma; + // Uses the outer radii of the window for a more realistic look + corner_radius = corner_radius + border_thickness; + pixman_region32_t damage; pixman_region32_init(&damage); pixman_region32_union_rect(&damage, &damage, box.x, box.y, @@ -1039,7 +1042,8 @@ static void render_containers_linear(struct sway_output *output, float blur_sigma = 20; struct wlr_box box = { state->x, state->y, state->width, state->height }; scale_box(&box, output->wlr_output->scale); - render_box_shadow(output, damage, &box, color, blur_sigma, deco_data.corner_radius); + render_box_shadow(output, damage, &box, color, blur_sigma, + deco_data.corner_radius, child->current.border_thickness); } else { render_container(output, damage, child, parent->focused || child->current.focused); diff --git a/sway/desktop/shaders/quad_round.frag b/sway/desktop/shaders/quad_round.frag index e63bf952..bf89b946 100644 --- a/sway/desktop/shaders/quad_round.frag +++ b/sway/desktop/shaders/quad_round.frag @@ -10,7 +10,7 @@ void main() { vec2 half_size = size / 2.0; vec2 q = abs(gl_FragCoord.xy - position - half_size) - half_size + radius; float distance = min(max(q.x,q.y),0.0) + length(max(q,0.0)) - radius; - float smoothedAlpha = 1.0 - smoothstep(-1.0, 1.0, distance); + float smoothedAlpha = 1.0 - smoothstep(-1.0, 0.5, distance); gl_FragColor = mix(vec4(0), v_color, smoothedAlpha); if (gl_FragColor.a == 0.0) { discard;