Improve code of view func
This commit is contained in:
parent
cefa1d8e8a
commit
d5e58baff8
20
dwm.c
20
dwm.c
|
@ -2673,24 +2673,23 @@ updatewmhints(Client *c)
|
||||||
void
|
void
|
||||||
view(const Arg *arg)
|
view(const Arg *arg)
|
||||||
{
|
{
|
||||||
int i;
|
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) return;
|
||||||
unsigned int tmptag;
|
|
||||||
|
|
||||||
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
|
||||||
return;
|
|
||||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||||
|
|
||||||
if (arg->ui & TAGMASK) {
|
if (arg->ui & TAGMASK) {
|
||||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||||
|
|
||||||
if (arg->ui == ~0)
|
if (arg->ui == ~0) {
|
||||||
selmon->pertag->curtag = 0;
|
selmon->pertag->curtag = 0;
|
||||||
else {
|
} else {
|
||||||
for (i = 0; !(arg->ui & 1 << i); i++) ;
|
int i = 0;
|
||||||
|
while (!(arg->ui & 1 << i)) ++i;
|
||||||
selmon->pertag->curtag = i + 1;
|
selmon->pertag->curtag = i + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tmptag = selmon->pertag->prevtag;
|
unsigned int tmptag = selmon->pertag->prevtag;
|
||||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||||
selmon->pertag->curtag = tmptag;
|
selmon->pertag->curtag = tmptag;
|
||||||
}
|
}
|
||||||
|
@ -2699,10 +2698,11 @@ view(const Arg *arg)
|
||||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||||
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
selmon->lt[selmon->sellt ^ 1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt ^ 1];
|
||||||
|
|
||||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag]) {
|
||||||
togglebar(NULL);
|
togglebar(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
|
|
Loading…
Reference in New Issue