From beffcdd61db4d54709869412dc8bee3288a1cf96 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sun, 13 Jul 2025 12:46:26 +0800 Subject: [PATCH] opt: optimize layer animation action set --- src/animation/layer.h | 4 +--- src/maomao.c | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/animation/layer.h b/src/animation/layer.h index bf7d72f..ae6d06d 100644 --- a/src/animation/layer.h +++ b/src/animation/layer.h @@ -416,7 +416,7 @@ void layer_set_pending_state(LayerSurface *l) { l->pending = l->geom; - if (l->animation.action == OPEN) { + if (l->animation.action == OPEN && !l->animation.running) { if ((!l->animation_type_open && strcmp(layer_animation_type_open, "zoom") == 0) || @@ -461,8 +461,6 @@ void layer_set_pending_state(LayerSurface *l) { l->animation.should_animate = false; } - l->animation.duration = animation_duration_open; - l->animation.action = OPEN; // 开始动画 layer_commit(l); l->dirty = true; diff --git a/src/maomao.c b/src/maomao.c index 301185b..1316e0c 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -2505,6 +2505,7 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) { // 初始化动画 if (animations && layer_animations && !l->noanim) { + l->animation.duration = animation_duration_open; l->animation.action = OPEN; layer_set_pending_state(l); } @@ -2554,6 +2555,7 @@ void commitlayersurfacenotify(struct wl_listener *listener, void *data) { l->geom.width = box.width; l->geom.height = box.height; l->animation.action = MOVE; + l->animation.duration = animation_duration_move; l->need_output_flush = true; layer_set_pending_state(l); }