From 415e072a3af292937f0b4c41acadafaee6958437 Mon Sep 17 00:00:00 2001 From: Erik Reider <35975961+ErikReider@users.noreply.github.com> Date: Fri, 19 May 2023 21:14:06 +0200 Subject: Add blur, shadow, and corner radius to layer-shell surfaces (#144) Co-authored-by: Will McKinnon --- sway/tree/workspace.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'sway/tree/workspace.c') diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 161b1e9c..8bc62f3f 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -5,11 +5,13 @@ #include #include #include +#include #include "stringop.h" #include "sway/input/input-manager.h" #include "sway/input/cursor.h" #include "sway/input/seat.h" #include "sway/ipc-server.h" +#include "sway/layers.h" #include "sway/output.h" #include "sway/tree/arrange.h" #include "sway/tree/container.h" @@ -702,7 +704,25 @@ bool should_workspace_have_blur(struct sway_workspace *ws) { if (!workspace_is_visible(ws)) { return false; } - return (bool)workspace_find_container(ws, find_blurred_con_iterator, NULL); + + if ((bool)workspace_find_container(ws, find_blurred_con_iterator, NULL)) { + return true; + } + + // Check if any layer-shell surfaces will render effects + struct sway_output *sway_output = ws->output; + size_t len = sizeof(sway_output->layers) / sizeof(sway_output->layers[0]); + for (size_t i = 0; i < len; ++i) { + struct sway_layer_surface *lsurface; + wl_list_for_each(lsurface, &sway_output->layers[i], link) { + if (lsurface->has_blur && !lsurface->layer_surface->surface->opaque + && lsurface->layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) { + return true; + } + } + } + + return false; } void workspace_for_each_container(struct sway_workspace *ws, -- cgit v1.2.3