opt:optimize border color change when tagmon

This commit is contained in:
DreamMaoMao 2025-03-30 19:52:45 +08:00
parent 2ab0da9cfa
commit b4dd299c22

View file

@ -5439,13 +5439,12 @@ void tag(const Arg *arg) {
void tagmon(const Arg *arg) { void tagmon(const Arg *arg) {
Client *c = focustop(selmon); Client *c = focustop(selmon);
Client *fc;
Monitor *m; Monitor *m;
if (c) { if (c) {
if(c == selmon->sel) {
selmon->sel = NULL;
}
m = dirtomon(arg->i); m = dirtomon(arg->i);
fc = focustop(selmon);
if(!fc)
selmon->sel = c;
setmon(c, m, 0); setmon(c, m, 0);
reset_foreign_tolevel(c); reset_foreign_tolevel(c);
// 重新计算居中的坐标 // 重新计算居中的坐标
@ -5455,16 +5454,18 @@ void tagmon(const Arg *arg) {
(int)(c->geom.height * c->mon->w.height / selmon->w.height); (int)(c->geom.height * c->mon->w.height / selmon->w.height);
selmon = c->mon; selmon = c->mon;
c->geom = setclient_coordinate_center(c->geom); c->geom = setclient_coordinate_center(c->geom);
focusclient(c, 1);
resize(c, c->geom, 1); resize(c, c->geom, 1);
} else { } else {
selmon = c->mon; selmon = c->mon;
focusclient(c, 1);
arrange(selmon, false); arrange(selmon, false);
} }
warp_cursor_to_selmon(c->mon); warp_cursor_to_selmon(c->mon);
focusclient(c, 1);
} }
} }
void overview(Monitor *m, unsigned int gappo, unsigned int gappi) { void overview(Monitor *m, unsigned int gappo, unsigned int gappi) {
grid(m, overviewgappo, overviewgappi); grid(m, overviewgappo, overviewgappi);
} }