diff --git a/sway/desktop/fx_renderer/fx_renderer.c b/sway/desktop/fx_renderer/fx_renderer.c index 920efade..5b1eadab 100644 --- a/sway/desktop/fx_renderer/fx_renderer.c +++ b/sway/desktop/fx_renderer/fx_renderer.c @@ -517,6 +517,12 @@ void fx_renderer_stencil_mask_fini() { bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer, struct wlr_texture *wlr_texture, const struct wlr_fbox *src_box, const struct wlr_box *dst_box, const float matrix[static 9], struct decoration_data deco_data) { + // Fixes corner radii not being "round" when the radii is larger than + // the height/width + int min_size = MIN(dst_box->height, dst_box->width) * 0.5; + if (deco_data.corner_radius > min_size) { + deco_data.corner_radius = min_size; + } struct wlr_gles2_texture_attribs *texture_attrs = malloc(sizeof(struct wlr_gles2_texture_attribs)); fx_renderer_get_texture_attribs(wlr_texture, texture_attrs); @@ -673,6 +679,13 @@ void fx_render_rounded_rect(struct fx_renderer *renderer, const struct wlr_box * } assert(box->width > 0 && box->height > 0); + // Fixes corner radii not being "round" when the radii is larger than + // the height/width + int min_size = MIN(box->height, box->width) * 0.5; + if (radius > min_size) { + radius = min_size; + } + struct rounded_quad_shader *shader = NULL; switch (corner_location) { @@ -734,6 +747,13 @@ void fx_render_border_corner(struct fx_renderer *renderer, const struct wlr_box } assert(box->width > 0 && box->height > 0); + // Fixes corner radii not being "round" when the radii is larger than + // the height/width + int min_size = MIN(box->height, box->width) * 0.5; + if (radius > min_size) { + radius = min_size; + } + float gl_matrix[9]; wlr_matrix_multiply(gl_matrix, renderer->projection, matrix); @@ -782,6 +802,13 @@ void fx_render_stencil_mask(struct fx_renderer *renderer, const struct wlr_box * } assert(box->width > 0 && box->height > 0); + // Fixes corner radii not being "round" when the radii is larger than + // the height/width + int min_size = MIN(box->height, box->width) * 0.5; + if (corner_radius > min_size) { + corner_radius = min_size; + } + // TODO: just pass gl_matrix? float gl_matrix[9]; wlr_matrix_multiply(gl_matrix, renderer->projection, matrix); @@ -823,6 +850,13 @@ void fx_render_box_shadow(struct fx_renderer *renderer, } assert(box->width > 0 && box->height > 0); + // Fixes corner radii not being "round" when the radii is larger than + // the height/width + int min_size = MIN(box->height, box->width) * 0.5; + if (corner_radius > min_size) { + corner_radius = min_size; + } + float gl_matrix[9]; wlr_matrix_multiply(gl_matrix, renderer->projection, matrix); diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 297bef62..2b648f5f 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -467,8 +467,12 @@ static void render_surface_iterator(struct sway_output *output, struct wlr_box monitor_box = get_monitor_box(wlr_output); wlr_box_transform(&monitor_box, &monitor_box, wlr_output_transform_invert(wlr_output->transform), monitor_box.width, monitor_box.height); - struct blur_stencil_data stencil_data = { texture, &src_box, matrix }; - bool should_optimize_blur = view ? !container_is_floating(view->container) || config->blur_xray : false; + struct blur_stencil_data stencil_data = { + texture, + &src_box, + matrix, + }; + bool should_optimize_blur = view ? !container_is_floating_or_child(view->container) || config->blur_xray : false; render_blur(should_optimize_blur, output, output_damage, &dst_box, &opaque_region, &deco_data, &stencil_data); } @@ -846,8 +850,12 @@ static void render_saved_view(struct sway_view *view, struct sway_output *output struct wlr_box monitor_box = get_monitor_box(wlr_output); wlr_box_transform(&monitor_box, &monitor_box, wlr_output_transform_invert(wlr_output->transform), monitor_box.width, monitor_box.height); - struct blur_stencil_data stencil_data = { saved_buf->buffer->texture, &saved_buf->source_box, matrix }; - bool should_optimize_blur = !container_is_floating(view->container) || config->blur_xray; + struct blur_stencil_data stencil_data = { + saved_buf->buffer->texture, + &saved_buf->source_box, + matrix, + }; + bool should_optimize_blur = !container_is_floating_or_child(view->container) || config->blur_xray; render_blur(should_optimize_blur, output, damage, &dst_box, &opaque_region, &deco_data, &stencil_data);