From d3cf4319cd8a0d7b90ae8c5038dccbc8cf91fbaf Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Wed, 1 Jul 2026 08:30:55 +0800 Subject: [PATCH] fix: fix shield and blur node offset --- src/animation/client.h | 27 ++++++++++++++++++++++----- src/mango.c | 6 ------ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/animation/client.h b/src/animation/client.h index ef75ca68..769846af 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -503,6 +503,7 @@ void client_draw_title(Client *c) { void apply_shield(Client *c, struct wlr_box clip_box) { if (clip_box.width <= 0 || clip_box.height <= 0) { + wlr_scene_node_set_enabled(&c->shield->node, false); return; } @@ -533,7 +534,6 @@ void apply_shield(Client *c, struct wlr_box clip_box) { } void client_draw_blur(Client *c, struct wlr_box clip_box, struct ivec2 offset) { - if (c->isfullscreen) { if (c->blur->node.enabled) { wlr_scene_node_set_enabled(&c->blur->node, false); @@ -541,12 +541,21 @@ void client_draw_blur(Client *c, struct wlr_box clip_box, struct ivec2 offset) { return; } else { if (config.blur && !c->noblur) { - int32_t blur_x = (int32_t)c->bw + offset.x; - int32_t blur_y = (int32_t)c->bw + offset.y; + if (c == grabc || (!ISSCROLLTILED(c) && !c->animation.tagining && + !c->animation.tagouting)) { + clip_box.x = 0; + clip_box.y = 0; + clip_box.width = + c->animation.current.width - 2 * (int32_t)c->bw; + clip_box.height = + c->animation.current.height - 2 * (int32_t)c->bw; + } + + int32_t blur_x = clip_box.x + (int32_t)c->bw; + int32_t blur_y = clip_box.y + (int32_t)c->bw; wlr_scene_node_set_enabled(&c->blur->node, true); wlr_scene_node_set_position(&c->blur->node, blur_x, blur_y); - wlr_scene_blur_set_size(c->blur, clip_box.width - c->bw, - clip_box.height - c->bw); + wlr_scene_blur_set_size(c->blur, clip_box.width, clip_box.height); } else { wlr_scene_node_set_enabled(&c->blur->node, false); } @@ -1049,6 +1058,14 @@ void client_apply_clip(Client *c, float factor) { apply_shield(c, clip_box); if (clip_box.width <= 0 || clip_box.height <= 0) { + should_render_client_surface = false; + wlr_scene_node_set_enabled(&c->scene_surface->node, false); + } else { + should_render_client_surface = true; + wlr_scene_node_set_enabled(&c->scene_surface->node, true); + } + + if (!should_render_client_surface) { return; } diff --git a/src/mango.c b/src/mango.c index ac660940..0f1c8987 100644 --- a/src/mango.c +++ b/src/mango.c @@ -1336,12 +1336,6 @@ void client_replace(Client *c, Client *w, bool is_group_change_member, mango_group_bar_set_focus(c->group_bar, c->isgroupfocusing); if (w->overview_scene_surface) { - - wlr_scene_node_reparent(&w->blur->node, w->overview_scene_surface); - wlr_scene_node_lower_to_bottom(&w->blur->node); - wlr_scene_node_reparent(&w->shield->node, w->overview_scene_surface); - wlr_scene_node_raise_to_top(&w->shield->node); - wlr_scene_node_destroy(&w->scene_surface->node); w->scene_surface = w->overview_scene_surface; w->overview_scene_surface = NULL;