Include pointer to sway_layer_surface in render_data
Better checks if the layer surface is a subsurface or not and only renders the shadows in the render_surface_iterator if said pointer isn't NULL
This commit is contained in:
parent
f1f0a9b115
commit
cdf106c43c
3 changed files with 7 additions and 20 deletions
|
@ -17,6 +17,7 @@ struct render_data {
|
||||||
pixman_region32_t *damage;
|
pixman_region32_t *damage;
|
||||||
struct wlr_box *clip_box;
|
struct wlr_box *clip_box;
|
||||||
struct decoration_data deco_data;
|
struct decoration_data deco_data;
|
||||||
|
struct sway_layer_surface *sway_layer;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_output_state {
|
struct sway_output_state {
|
||||||
|
|
|
@ -200,6 +200,7 @@ void output_layer_for_each_toplevel_surface(struct sway_output *output,
|
||||||
struct wlr_layer_surface_v1 *wlr_layer_surface_v1 =
|
struct wlr_layer_surface_v1 *wlr_layer_surface_v1 =
|
||||||
layer_surface->layer_surface;
|
layer_surface->layer_surface;
|
||||||
struct render_data *data = user_data;
|
struct render_data *data = user_data;
|
||||||
|
data->sway_layer = layer_surface;
|
||||||
if (layer_surface->effects) {
|
if (layer_surface->effects) {
|
||||||
data->deco_data = layer_surface->effects->deco_data;
|
data->deco_data = layer_surface->effects->deco_data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,12 +450,15 @@ static void render_surface_iterator(struct sway_output *output,
|
||||||
deco_data.corner_radius *= wlr_output->scale;
|
deco_data.corner_radius *= wlr_output->scale;
|
||||||
|
|
||||||
// render blur (view->surface == surface excludes blurring subsurfaces)
|
// 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 is_subsurface = false;
|
||||||
bool should_optimize_blur = deco_data.can_blur_xray && config->blur_xray;
|
bool should_optimize_blur = deco_data.can_blur_xray && config->blur_xray;
|
||||||
if (view) {
|
if (view) {
|
||||||
is_subsurface = view->surface != surface;
|
is_subsurface = view->surface != surface;
|
||||||
should_optimize_blur = !container_is_floating(view->container) || config->blur_xray;
|
should_optimize_blur = !container_is_floating(view->container) || config->blur_xray;
|
||||||
}
|
}
|
||||||
|
if (data->sway_layer) {
|
||||||
|
is_subsurface = data->sway_layer->layer_surface->surface != surface;
|
||||||
|
}
|
||||||
if (deco_data.blur && should_parameters_blur() && !is_subsurface) {
|
if (deco_data.blur && should_parameters_blur() && !is_subsurface) {
|
||||||
pixman_region32_t opaque_region;
|
pixman_region32_t opaque_region;
|
||||||
pixman_region32_init(&opaque_region);
|
pixman_region32_init(&opaque_region);
|
||||||
|
@ -493,26 +496,8 @@ static void render_surface_iterator(struct sway_output *output,
|
||||||
wlr_output);
|
wlr_output);
|
||||||
|
|
||||||
// render shadow (view->surface == surface excludes shadow on subsurfaces)
|
// render shadow (view->surface == surface excludes shadow on subsurfaces)
|
||||||
if (deco_data.shadow && should_parameters_shadow() && !is_subsurface && !view) {
|
if (deco_data.shadow && should_parameters_shadow() && !is_subsurface && data->sway_layer) {
|
||||||
int corner_radius = deco_data.corner_radius;
|
int corner_radius = deco_data.corner_radius;
|
||||||
if (view) {
|
|
||||||
struct sway_container *con = view->container;
|
|
||||||
struct sway_container_state *state = &con->current;
|
|
||||||
|
|
||||||
// Only draw shadows on CSD windows if shadows_on_csd is enabled
|
|
||||||
if (con->current.border == B_CSD && !config->shadows_on_csd_enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
corner_radius = (con->corner_radius + state->border_thickness) * wlr_output->scale;
|
|
||||||
|
|
||||||
// Account for titlebars
|
|
||||||
dst_box.x = floor(state->x) - output->lx;
|
|
||||||
dst_box.y = floor(state->y) - output->ly;
|
|
||||||
dst_box.width = state->width;
|
|
||||||
dst_box.height = state->height;
|
|
||||||
scale_box(&dst_box, wlr_output->scale);
|
|
||||||
}
|
|
||||||
render_box_shadow(output, output_damage, &dst_box, config->shadow_color,
|
render_box_shadow(output, output_damage, &dst_box, config->shadow_color,
|
||||||
config->shadow_blur_sigma, corner_radius);
|
config->shadow_blur_sigma, corner_radius);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue