fix: fix scenefx next

This commit is contained in:
DreamMaoMao 2026-06-19 14:18:25 +08:00
parent 046412b159
commit e9b551c87d
4 changed files with 44 additions and 43 deletions

View file

@ -12,7 +12,8 @@ void set_rect_size(struct wlr_scene_rect *rect, int32_t width, int32_t height) {
struct fx_corner_radii set_client_corner_location(Client *c) { struct fx_corner_radii set_client_corner_location(Client *c) {
struct fx_corner_radii current_corner_location = struct fx_corner_radii current_corner_location =
corner_radii_all(config.border_radius); corner_radii_all(config.border_radius);
struct wlr_box target_geom = config.animations ? c->animation.current : c->geom; struct wlr_box target_geom =
config.animations ? c->animation.current : c->geom;
if (target_geom.x + config.border_radius <= c->mon->m.x) { if (target_geom.x + config.border_radius <= c->mon->m.x) {
current_corner_location.top_left = 0; // 清除左标志位 current_corner_location.top_left = 0; // 清除左标志位
current_corner_location.bottom_left = 0; // 清除左标志位 current_corner_location.bottom_left = 0; // 清除左标志位
@ -240,7 +241,6 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int32_t sx,
return; return;
wlr_scene_buffer_set_corner_radii(buffer, buffer_data->corner_location); wlr_scene_buffer_set_corner_radii(buffer, buffer_data->corner_location);
} }
void scene_buffer_apply_overview_effect(struct wlr_scene_buffer *buffer, void scene_buffer_apply_overview_effect(struct wlr_scene_buffer *buffer,
@ -288,7 +288,7 @@ void buffer_set_effect(Client *c, BufferData data) {
if (c == grabc) if (c == grabc)
data.should_scale = false; data.should_scale = false;
if (c->isfullscreen || (no_radius_when_single && c->mon && if (c->isfullscreen || (config.no_radius_when_single && c->mon &&
c->mon->visible_tiling_clients == 1)) { c->mon->visible_tiling_clients == 1)) {
data.corner_location = corner_radii_none(); data.corner_location = corner_radii_none();
} }
@ -420,10 +420,21 @@ void apply_shield(Client *c, struct wlr_box clip_box) {
} }
void client_draw_blur(Client *c, struct wlr_box clip_box, struct ivec2 offset) { void client_draw_blur(Client *c, struct wlr_box clip_box, struct ivec2 offset) {
if (blur && !c->noblur) {
if (c->isfullscreen) {
if (c->blur->node.enabled) {
wlr_scene_node_set_enabled(&c->blur->node, false);
}
return;
} else {
if (config.blur && !c->noblur) {
wlr_scene_node_set_enabled(&c->blur->node, true);
wlr_scene_node_set_position(&c->blur->node, offset.x, offset.y); wlr_scene_node_set_position(&c->blur->node, offset.x, offset.y);
wlr_scene_blur_set_size(c->blur, clip_box.width - c->bw, wlr_scene_blur_set_size(c->blur, clip_box.width - c->bw,
clip_box.height - c->bw); clip_box.height - c->bw);
} else {
wlr_scene_node_set_enabled(&c->blur->node, false);
}
} }
} }
@ -538,7 +549,8 @@ void apply_border(Client *c) {
if (c->isfullscreen) { if (c->isfullscreen) {
if (c->border->node.enabled) { if (c->border->node.enabled) {
wlr_scene_node_set_position(&c->scene_surface->node, 0, 0); wlr_scene_node_set_enabled(&c->splitindicator[0]->node, false);
wlr_scene_node_set_enabled(&c->splitindicator[1]->node, false);
wlr_scene_node_set_enabled(&c->border->node, false); wlr_scene_node_set_enabled(&c->border->node, false);
} }
return; return;
@ -552,7 +564,7 @@ void apply_border(Client *c) {
apply_split_border(c, hit_no_border); apply_split_border(c, hit_no_border);
struct fx_corner_radii current_corner_location = struct fx_corner_radii current_corner_location =
c->isfullscreen || (no_radius_when_single && c->mon && c->isfullscreen || (config.no_radius_when_single && c->mon &&
c->mon->visible_tiling_clients == 1) c->mon->visible_tiling_clients == 1)
? corner_radii_none() ? corner_radii_none()
: set_client_corner_location(c); : set_client_corner_location(c);
@ -1320,7 +1332,7 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
return; return;
struct wlr_box *bbox; struct wlr_box *bbox;
struct wlr_box clip; struct wlr_box clip_box;
if (!c->mon) if (!c->mon)
return; return;
@ -1411,12 +1423,16 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
c->geom; c->geom;
wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y); wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y);
client_draw_shadow(c); struct ivec2 offset = clip_to_hide(c, &clip_box);
apply_shield(c, clip);
apply_border(c); apply_border(c);
client_get_clip(c, &clip); client_draw_shadow(c);
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip); apply_shield(c, clip_box);
if (blur && !c->noblur) client_draw_blur(c, clip_box, offset);
client_get_clip(c, &clip_box);
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
if (config.blur && !c->noblur)
wlr_scene_blur_set_size(c->blur, wlr_scene_blur_set_size(c->blur,
c->animation.current.width - 2 * c->bw, c->animation.current.width - 2 * c->bw,
c->animation.current.height - 2 * c->bw); c->animation.current.height - 2 * c->bw);
@ -1549,14 +1565,14 @@ bool client_apply_focus_opacity(Client *c) {
sizeof(c->opacity_animation.current_border_color)); sizeof(c->opacity_animation.current_border_color));
c->opacity_animation.current_opacity = target_opacity; c->opacity_animation.current_opacity = target_opacity;
client_set_opacity(c, target_opacity); client_set_opacity(c, target_opacity);
if (blur && !c->noblur && !blur_optimized) { if (config.blur && !c->noblur && !config.blur_optimized) {
wlr_scene_blur_set_strength( wlr_scene_blur_set_strength(
c->blur, MIN(percent * (1.0 - fadein_begin_opacity) + c->blur, MIN(percent * (1.0 - config.fadein_begin_opacity) +
fadein_begin_opacity, config.fadein_begin_opacity,
1.0)); 1.0));
wlr_scene_blur_set_alpha( wlr_scene_blur_set_alpha(
c->blur, MIN(percent * (1.0 - fadein_begin_opacity) + c->blur, MIN(percent * (1.0 - config.fadein_begin_opacity) +
fadein_begin_opacity, config.fadein_begin_opacity,
1.0)); 1.0));
} }
client_set_border_color(c, c->opacity_animation.target_border_color); client_set_border_color(c, c->opacity_animation.target_border_color);

View file

@ -328,7 +328,7 @@ void layer_animation_next_tick(LayerSurface *l) {
1.0f); 1.0f);
if (config.animation_fade_in) { if (config.animation_fade_in) {
if (blur && !l->noblur && !blur_optimized) { if (config.blur && !l->noblur && !config.blur_optimized) {
wlr_scene_blur_set_strength(l->blur, opacity); wlr_scene_blur_set_strength(l->blur, opacity);
wlr_scene_blur_set_alpha(l->blur, opacity); wlr_scene_blur_set_alpha(l->blur, opacity);
} }
@ -362,7 +362,7 @@ void layer_animation_next_tick(LayerSurface *l) {
.height = height, .height = height,
}; };
if (blur && blur_layer && !l->noblur && l->blur) if (config.blur && config.blur_layer && !l->noblur && l->blur)
wlr_scene_blur_set_size(l->blur, l->animation.current.width, wlr_scene_blur_set_size(l->blur, l->animation.current.width,
l->animation.current.height); l->animation.current.height);

View file

@ -3742,7 +3742,6 @@ void set_value_default() {
config.blur_layer = 0; config.blur_layer = 0;
config.blur_optimized = 1; config.blur_optimized = 1;
config.border_radius = 0; config.border_radius = 0;
config.border_radius_location_default = CORNER_LOCATION_ALL;
config.blur_params.num_passes = 1; config.blur_params.num_passes = 1;
config.blur_params.radius = 5; config.blur_params.radius = 5;
config.blur_params.noise = 0.02f; config.blur_params.noise = 0.02f;

View file

@ -2743,19 +2743,6 @@ static void iter_layer_scene_buffers(struct wlr_scene_buffer *buffer,
} }
} }
void layer_flush_blur_background(LayerSurface *l) {
if (!blur)
return;
// 如果背景层发生变化,标记优化的模糊背景缓存需要更新
if (l->layer_surface->current.layer ==
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
if (l->mon) {
wlr_scene_optimized_blur_mark_dirty(l->mon->blur);
}
}
}
void layer_flush_blur_background(LayerSurface *l) { void layer_flush_blur_background(LayerSurface *l) {
if (!config.blur) if (!config.blur)
return; return;
@ -2813,8 +2800,9 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
if (layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM && if (layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) { layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
if (layer_surface->current.exclusive_zone == 0) { if (layer_surface->current.exclusive_zone == 0) {
l->shadow = wlr_scene_shadow_create(l->scene, 0, 0, border_radius, l->shadow = wlr_scene_shadow_create(
shadows_blur, shadowscolor); l->scene, 0, 0, config.border_radius, config.shadows_blur,
config.shadowscolor);
wlr_scene_node_lower_to_bottom(&l->shadow->node); wlr_scene_node_lower_to_bottom(&l->shadow->node);
wlr_scene_node_set_enabled(&l->shadow->node, true); wlr_scene_node_set_enabled(&l->shadow->node, true);
} }
@ -4459,14 +4447,11 @@ static void iter_xdg_scene_buffers(struct wlr_scene_buffer *buffer, int32_t sx,
return; return;
if (config.blur && c && !c->noblur) { if (config.blur && c && !c->noblur) {
wlr_scene_node_set_enabled(&c->blur->node, true); if (config.blur_optimized) {
if (blur_optimized) {
wlr_scene_blur_set_should_only_blur_bottom_layer(c->blur, true); wlr_scene_blur_set_should_only_blur_bottom_layer(c->blur, true);
} else { } else {
wlr_scene_blur_set_should_only_blur_bottom_layer(c->blur, false); wlr_scene_blur_set_should_only_blur_bottom_layer(c->blur, false);
} }
} else {
wlr_scene_node_set_enabled(&c->blur->node, false);
} }
} }
@ -4656,7 +4641,8 @@ mapnotify(struct wl_listener *listener, void *data) {
c->scene, 0, 0, c->isurgent ? config.urgentcolor : config.bordercolor); c->scene, 0, 0, c->isurgent ? config.urgentcolor : config.bordercolor);
wlr_scene_node_lower_to_bottom(&c->border->node); wlr_scene_node_lower_to_bottom(&c->border->node);
wlr_scene_node_set_position(&c->border->node, 0, 0); wlr_scene_node_set_position(&c->border->node, 0, 0);
wlr_scene_rect_set_corner_radii(c->border, corner_radii_all(config.border_radius)); wlr_scene_rect_set_corner_radii(c->border,
corner_radii_all(config.border_radius));
wlr_scene_node_set_enabled(&c->border->node, true); wlr_scene_node_set_enabled(&c->border->node, true);
c->shadow = c->shadow =