From c835a2955961c1645a45c6387c5af21d47f07022 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 181f206..709a2cf 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -498,18 +498,11 @@ void client_apply_clip(Client *c, float factor) { bool should_render_client_surface = false; struct ivec2 offset; animationScale scale_data; + float opacity, percent; enum corner_location current_corner_location = set_client_corner_location(c); - 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; - int bw = (int)c->bw; if (!animations) { @@ -540,6 +533,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);