From f0d61273b652e3268f49c095d2b247c07afd441b Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Wed, 27 Aug 2025 09:38:22 +0800 Subject: [PATCH] opt: avoid useless view action --- src/mango.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mango.c b/src/mango.c index 6fd2307..6545b73 100644 --- a/src/mango.c +++ b/src/mango.c @@ -1211,11 +1211,9 @@ void applyrules(Client *c) { !c->isopensilent && (!c->istagsilent || !newtags || newtags & mon->tagset[mon->seltags])); - if (!c->isopensilent && - (!c->istagsilent || c->tags & c->mon->tagset[c->mon->seltags]) && - c->mon && - ((c->mon && c->mon != selmon) || - !(c->tags & (1 << (c->mon->pertag->curtag - 1))))) { + if (c->mon && + !(c->mon == selmon && c->tags & c->mon->tagset[c->mon->seltags]) && + !c->isopensilent && !c->istagsilent) { c->animation.tag_from_rule = true; view_in_mon(&(Arg){.ui = c->tags}, true, c->mon); } @@ -5107,7 +5105,8 @@ urgent(struct wl_listener *listener, void *data) { return; if (focus_on_activate && !c->istagsilent && c != selmon->sel) { - view(&(Arg){.ui = c->tags}, true); + if (!(c->mon == selmon && c->tags & c->mon->tagset[c->mon->seltags])) + view(&(Arg){.ui = c->tags}, true); focusclient(c, 1); } else if (c != focustop(selmon)) { if (client_surface(c)->mapped) @@ -5229,7 +5228,8 @@ void activatex11(struct wl_listener *listener, void *data) { } if (focus_on_activate && !c->istagsilent && c != selmon->sel) { - view(&(Arg){.ui = c->tags}, true); + if (!(c->mon == selmon && c->tags & c->mon->tagset[c->mon->seltags])) + view(&(Arg){.ui = c->tags}, true); wlr_xwayland_surface_activate(c->surface.xwayland, 1); focusclient(c, 1); need_arrange = false;