opt: optimize focusmon

This commit is contained in:
DreamMaoMao 2025-03-30 18:57:32 +08:00
parent 26dc1995d5
commit 2ab0da9cfa

View file

@ -4905,8 +4905,9 @@ void setsmfact(const Arg *arg) {
arrange(selmon, false);
}
void // 0.5
setmon(Client *c, Monitor *m, uint32_t newtags) {
void
setmon(Client *c, Monitor *m, uint32_t newtags)
{
Monitor *oldmon = c->mon;
if (oldmon == m)
@ -4920,15 +4921,11 @@ setmon(Client *c, Monitor *m, uint32_t newtags) {
if (m) {
/* Make sure window actually overlaps with the monitor */
resize(c, c->geom, 0);
c->tags = newtags
? newtags
: m->tagset[m->seltags]; /* assign tags of target monitor */
setfloating(c, c->isfloating);
c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */
setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
if(c && VISIBLEON(c, c->mon))
focusclient(c,1);
setfloating(c, c->isfloating);
}
focusclient(focustop(selmon), 1);
}
void // 17