尝试剪切fadeout划出屏幕的border

sdfsd
This commit is contained in:
DreamMaoMao 2025-02-25 18:13:03 +08:00
parent 771c3199c2
commit ae48bd62a7

View file

@ -721,7 +721,7 @@ double find_animation_curve_at(double t) {
}
// 有 bug,只是让上面那根透明了
void apply_opacity_to_rect_nodes(struct wlr_scene_node *node, double animation_passed) {
void apply_opacity_to_rect_nodes(Client *c,struct wlr_scene_node *node, double animation_passed) {
if (node->type == WLR_SCENE_NODE_RECT) {
struct wlr_scene_rect *rect = wlr_scene_rect_from_node(node);
// Assuming the rect has a color field and we can modify it
@ -730,6 +730,17 @@ void apply_opacity_to_rect_nodes(struct wlr_scene_node *node, double animation_p
rect->color[2] = (1- animation_passed ) * rect->color[2];
rect->color[3] = (1- animation_passed ) * rect->color[3];
wlr_scene_rect_set_color(rect, rect->color);
// TODO: 判断当前窗口是否在屏幕外,如果在屏幕外就不要绘制
// 划出的border剪切屏幕之外的这里底部bttome可以了左右的还不不对
// if(node->y > c->geom.height/2 && c->geom.y + c->animation.current.y + node->y >= c->mon->m.y + c->mon->m.height){
// wlr_scene_rect_set_size(rect, 0, 0); // down
// } else if(node->x > c->geom.width/2 && c->geom.y + c->animation.current.y + node->y >= c->mon->m.y + c->mon->m.height) {
// wlr_scene_rect_set_size(rect, c->bw,rect->height - (c->geom.y + c->animation.current.y + node->y - c->mon->m.y - c->mon->m.height)); // right
// } else if(rect->height > rect->width && c->geom.y + c->animation.current.y + node->y >= c->mon->m.y + c->mon->m.height) {
// wlr_scene_rect_set_size(rect, c->bw,rect->height - (c->geom.y + c->animation.current.y + node->y - c->mon->m.y - c->mon->m.height)); // left
// }
}
// If the node is a tree, recursively traverse its children
@ -737,7 +748,7 @@ void apply_opacity_to_rect_nodes(struct wlr_scene_node *node, double animation_p
struct wlr_scene_tree *scene_tree = wlr_scene_tree_from_node(node);
struct wlr_scene_node *child;
wl_list_for_each(child, &scene_tree->children, link) {
apply_opacity_to_rect_nodes(child, animation_passed);
apply_opacity_to_rect_nodes(c, child, animation_passed);
}
}
}
@ -773,7 +784,7 @@ void fadeout_client_animation_next_tick(Client *c) {
wlr_scene_node_for_each_buffer(&c->scene->node,
scene_buffer_apply_opacity, &opacity);
apply_opacity_to_rect_nodes(&c->scene->node, animation_passed);
apply_opacity_to_rect_nodes(c, &c->scene->node, animation_passed);
if (animation_passed == 1.0) {
wl_list_remove(&c->fadeout_link);