From ae48bd62a72e5597eb4a3fb65dc3d3bcf2be08d2 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 25 Feb 2025 18:13:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E5=89=AA=E5=88=87fadeout?= =?UTF-8?q?=E5=88=92=E5=87=BA=E5=B1=8F=E5=B9=95=E7=9A=84border?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sdfsd --- maomao.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/maomao.c b/maomao.c index 54e5c456..8e47cb73 100644 --- a/maomao.c +++ b/maomao.c @@ -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);