This commit is contained in:
DreamMaoMao 2026-03-23 10:13:38 +08:00 committed by GitHub
commit b4eacb4532
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 101 additions and 1 deletions

View file

@ -350,6 +350,22 @@ void client_draw_shadow(Client *c) {
wlr_scene_shadow_set_clipped_region(c->shadow, clipped_region);
}
void apply_shield(Client *c, struct wlr_box clip_box) {
if (active_capture_count > 0 && c->shield_when_capture) {
wlr_scene_node_raise_to_top(&c->shield->node);
wlr_scene_node_set_position(&c->shield->node, clip_box.x, clip_box.y);
wlr_scene_rect_set_size(c->shield, clip_box.width, clip_box.height);
wlr_scene_node_set_enabled(&c->shield->node, true);
} else {
if (c->shield->node.enabled) {
wlr_scene_node_lower_to_bottom(&c->shield->node);
wlr_scene_rect_set_size(c->shield, c->animation.current.width,
c->animation.current.height);
wlr_scene_node_set_enabled(&c->shield->node, false);
}
}
}
void apply_border(Client *c) {
if (!c || c->iskilling || !client_surface(c)->mapped)
return;
@ -540,6 +556,7 @@ void client_apply_clip(Client *c, float factor) {
return;
}
apply_shield(c, clip_box);
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
buffer_set_effect(c, (BufferData){1.0f, 1.0f, clip_box.width,
clip_box.height,
@ -588,6 +605,7 @@ void client_apply_clip(Client *c, float factor) {
}
// 应用窗口表面剪切
apply_shield(c, clip_box);
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
// 获取剪切后的表面的实际大小用于计算缩放
@ -765,6 +783,10 @@ void init_fadeout_client(Client *c) {
return;
}
if (c->shield_when_capture && active_capture_count > 0) {
return;
}
if ((c->animation_type_close &&
strcmp(c->animation_type_close, "none") == 0) ||
(!c->animation_type_close &&
@ -1004,6 +1026,7 @@ void resize(Client *c, struct wlr_box geo, int32_t interact) {
client_draw_shadow(c);
apply_border(c);
client_get_clip(c, &clip);
apply_shield(c, clip);
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip);
return;
}