From 5429b723f65f50fa34e51b3e5d26c869a056bfc0 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Mon, 20 Oct 2025 17:58:01 +0800 Subject: [PATCH] opt: make tag animation more consistent --- src/animation/tag.h | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/animation/tag.h b/src/animation/tag.h index 4110efb..8e65a93 100644 --- a/src/animation/tag.h +++ b/src/animation/tag.h @@ -9,19 +9,23 @@ void set_tagin_animation(Monitor *m, Client *c) { c->animainit_geom.x = tag_animation_direction == VERTICAL ? c->animation.current.x - : c->mon->m.x + c->mon->m.width; + : MAX(c->mon->m.x + c->mon->m.width, + c->geom.x + c->mon->m.width); c->animainit_geom.y = tag_animation_direction == VERTICAL - ? c->mon->m.y + c->mon->m.height + ? MAX(c->mon->m.y + c->mon->m.height, + c->geom.y + c->mon->m.height) : c->animation.current.y; } else { - c->animainit_geom.x = tag_animation_direction == VERTICAL - ? c->animation.current.x - : m->m.x - c->geom.width; - c->animainit_geom.y = tag_animation_direction == VERTICAL - ? m->m.y - c->geom.height - : c->animation.current.y; + c->animainit_geom.x = + tag_animation_direction == VERTICAL + ? c->animation.current.x + : MIN(m->m.x - c->geom.width, c->geom.x - c->mon->m.width); + c->animainit_geom.y = + tag_animation_direction == VERTICAL + ? MIN(m->m.y - c->geom.height, c->geom.y - c->mon->m.height) + : c->animation.current.y; } } @@ -52,11 +56,13 @@ void set_arrange_visible(Monitor *m, Client *c, bool want_animation) { void set_tagout_animation(Monitor *m, Client *c) { if (m->pertag->curtag > m->pertag->prevtag) { c->pending = c->geom; - c->pending.x = tag_animation_direction == VERTICAL - ? c->animation.current.x - : c->mon->m.x - c->geom.width; + c->pending.x = + tag_animation_direction == VERTICAL + ? c->animation.current.x + : MIN(c->mon->m.x - c->geom.width, c->geom.x - c->mon->m.width); c->pending.y = tag_animation_direction == VERTICAL - ? c->mon->m.y - c->geom.height + ? MIN(c->mon->m.y - c->geom.height, + c->geom.y - c->mon->m.height) : c->animation.current.y; resize(c, c->geom, 0); @@ -64,9 +70,11 @@ void set_tagout_animation(Monitor *m, Client *c) { c->pending = c->geom; c->pending.x = tag_animation_direction == VERTICAL ? c->animation.current.x - : c->mon->m.x + c->mon->m.width; + : MAX(c->mon->m.x + c->mon->m.width, + c->geom.x + c->mon->m.width); c->pending.y = tag_animation_direction == VERTICAL - ? c->mon->m.y + c->mon->m.height + ? MAX(c->mon->m.y + c->mon->m.height, + c->geom.y + c->mon->m.height) : c->animation.current.y; resize(c, c->geom, 0); }