From 32cf3c120c22ffe27398320dc07ffb5d4f086196 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 19 Apr 2025 22:30:42 +0800 Subject: [PATCH] opt: optimize prevtag set --- src/maomao.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/maomao.c b/src/maomao.c index e2e5670..4b4eed4 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -6807,14 +6807,14 @@ void view_in_mon(const Arg *arg, bool want_animation, Monitor *m) { if (!m || (arg->ui != ~0 && m->isoverview)) { return; } - if ((m->tagset[m->seltags] & arg->ui & TAGMASK) != 0) { - want_animation = false; - } + // if ((m->tagset[m->seltags] & arg->ui & TAGMASK) != 0) { + // want_animation = false; + // } m->seltags ^= 1; /* toggle sel tagset */ if (arg->ui & TAGMASK) { m->tagset[m->seltags] = arg->ui & TAGMASK; - m->pertag->prevtag = m->pertag->curtag; + tmptag = m->pertag->curtag; if (arg->ui == ~0) m->pertag->curtag = 0; @@ -6823,6 +6823,8 @@ void view_in_mon(const Arg *arg, bool want_animation, Monitor *m) { ; m->pertag->curtag = i + 1; } + + m->pertag->prevtag = tmptag == m->pertag->curtag? m->pertag->prevtag:tmptag; } else { tmptag = m->pertag->prevtag; m->pertag->prevtag = m->pertag->curtag;