From 03d3f992f267b8a3fc5056e2c34c24c78db0891e Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 15 Jul 2025 16:28:03 +0800 Subject: [PATCH] opt: optimize code struct --- src/animation/client.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/animation/client.h b/src/animation/client.h index 58ea57c..63d7871 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -374,14 +374,7 @@ void client_apply_clip(Client *c, float factor) { bool should_render_client_surface = false; struct ivec2 offset; animationScale scale_data; - - float percent = - c->animation.action == OPEN && animation_fade_in && !c->nofadein - ? (double)c->animation.passed_frames / c->animation.total_frames - : 1.0; - float opacity = c->isfullscreen ? 1 - : c == selmon->sel ? c->focused_opacity - : c->unfocused_opacity; + float opacity, percent; int bw = (int)c->bw; @@ -413,6 +406,14 @@ void client_apply_clip(Client *c, float factor) { return; } + percent = + c->animation.action == OPEN && animation_fade_in && !c->nofadein + ? (double)c->animation.passed_frames / c->animation.total_frames + : 1.0; + opacity = c->isfullscreen ? 1 + : c == selmon->sel ? c->focused_opacity + : c->unfocused_opacity; + // 获取窗口动画实时位置矩形 unsigned int width, height; client_actual_size(c, &width, &height);