diff --git a/include/sway/desktop/fx_renderer/fx_renderer.h b/include/sway/desktop/fx_renderer/fx_renderer.h index 2e78357c..4f2fd1db 100644 --- a/include/sway/desktop/fx_renderer/fx_renderer.h +++ b/include/sway/desktop/fx_renderer/fx_renderer.h @@ -18,6 +18,7 @@ .saturation = 1.0f, \ .has_titlebar = false, \ .blur = false, \ + .can_blur_xray = false, \ .shadow = false, \ } @@ -45,6 +46,7 @@ struct decoration_data { float *dim_color; bool has_titlebar; bool blur; + bool can_blur_xray; bool shadow; }; diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 85ea639c..256ad98c 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -692,6 +692,8 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { struct layer_effects *effect = config->layer_effects->items[i]; if (strcmp(effect->namespace, layer_surface->namespace) == 0) { sway_layer->effects = effect; + // Blur optimization won't work for BOTTOM layered surfaces + sway_layer->effects->deco_data.can_blur_xray = layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; break; } } diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 04b34f30..e7f28692 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -333,7 +333,7 @@ void render_blur(bool optimized, struct sway_output *output, wlr_region_scale(&inverse_opaque, &inverse_opaque, wlr_output->scale); struct fx_framebuffer *buffer = &renderer->blur_buffer; - if (!buffer->texture.id || (!optimized && !config->blur_xray)) { + if (!buffer->texture.id || !optimized) { pixman_region32_translate(&inverse_opaque, dst_box->x, dst_box->y); pixman_region32_intersect(&inverse_opaque, &inverse_opaque, &damage); @@ -451,10 +451,10 @@ static void render_surface_iterator(struct sway_output *output, // render blur (view->surface == surface excludes blurring subsurfaces) bool is_subsurface = false; // TODO: discussion here, would all cases where view is null be a non subsurface? - bool should_optimize_blur = config->blur_xray; // TODO: for layershell bottom layer should be optimized + bool should_optimize_blur = deco_data.can_blur_xray && config->blur_xray; if (view) { is_subsurface = view->surface != surface; - should_optimize_blur = !container_is_floating(view->container); + should_optimize_blur = !container_is_floating(view->container) || config->blur_xray; } if (deco_data.blur && should_parameters_blur() && !is_subsurface) { pixman_region32_t opaque_region; @@ -1446,6 +1446,7 @@ static void render_containers_linear(struct sway_output *output, .saturation = child->saturation, .has_titlebar = has_titlebar, .blur = child->blur_enabled, + .can_blur_xray = true, .shadow = child->shadow_enabled, }; render_view(output, damage, child, colors, deco_data); @@ -1496,6 +1497,7 @@ static void render_containers_tabbed(struct sway_output *output, .saturation = current->saturation, .has_titlebar = true, .blur = current->blur_enabled, + .can_blur_xray = true, }; // Render tabs @@ -1591,6 +1593,7 @@ static void render_containers_stacked(struct sway_output *output, ? 0 : current->corner_radius, .has_titlebar = true, .blur = current->blur_enabled, + .can_blur_xray = true, }; // Render titles @@ -1738,6 +1741,7 @@ static void render_floating_container(struct sway_output *soutput, .corner_radius = con->corner_radius, .has_titlebar = has_titlebar, .blur = con->blur_enabled, + .can_blur_xray = true, .shadow = con->shadow_enabled, }; render_view(soutput, damage, con, colors, deco_data); @@ -1855,7 +1859,9 @@ static struct workspace_effect_info get_workspace_effect_info(struct sway_output if (layer_effects->deco_data.blur && !lsurface->layer_surface->surface->opaque) { effect_info.container_wants_blur = true; // Check if we should render optimized blur - if (renderer->blur_buffer_dirty && config->blur_xray) { + if (renderer->blur_buffer_dirty && config->blur_xray + && lsurface->layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND + && lsurface->layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) { effect_info.should_render_optimized_blur = true; } } @@ -2079,6 +2085,7 @@ void output_render(struct sway_output *output, struct timespec *when, .saturation = focus->saturation, .has_titlebar = false, .blur = false, + .can_blur_xray = false, .shadow = false, }; render_view_popups(focus->view, output, damage, deco_data); diff --git a/sway/sway.5.scd b/sway/sway.5.scd index 8d23a265..9ad3626e 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd @@ -74,8 +74,8 @@ The following commands may only be used in the configuration file. *layer_effects* Apply effects on specific layer shell surfaces, eg waybar or rofi. At least one effect needs to be provided. The can be - gotten through *sway-ipc*. Note: only surfaces in the _top_ and _overlay_ - layers can use these effects. + gotten through *sway-ipc*. Note: Surfaces in the _bottom_ layer cannot + use these effects. Effects: - *blur*