mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
pertag: simplifying implementation by removing prevtag
This commit is contained in:
parent
6c822cbfce
commit
40e2cac4e9
9
dwm.c
9
dwm.c
@ -1687,7 +1687,7 @@ createmon(void)
|
|||||||
#if PERTAG_PATCH
|
#if PERTAG_PATCH
|
||||||
if (!(m->pertag = (Pertag *)calloc(1, sizeof(Pertag))))
|
if (!(m->pertag = (Pertag *)calloc(1, sizeof(Pertag))))
|
||||||
die("fatal: could not malloc() %u bytes\n", sizeof(Pertag));
|
die("fatal: could not malloc() %u bytes\n", sizeof(Pertag));
|
||||||
m->pertag->curtag = m->pertag->prevtag = 1;
|
m->pertag->curtag = 1;
|
||||||
for (i = 0; i <= NUMTAGS; i++) {
|
for (i = 0; i <= NUMTAGS; i++) {
|
||||||
#if FLEXTILE_DELUXE_LAYOUT
|
#if FLEXTILE_DELUXE_LAYOUT
|
||||||
m->pertag->nstacks[i] = m->nstack;
|
m->pertag->nstacks[i] = m->nstack;
|
||||||
@ -4261,12 +4261,10 @@ toggleview(const Arg *arg)
|
|||||||
if (newtagset == ~0)
|
if (newtagset == ~0)
|
||||||
#endif // SCRATCHPADS_PATCH
|
#endif // SCRATCHPADS_PATCH
|
||||||
{
|
{
|
||||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
|
||||||
selmon->pertag->curtag = 0;
|
selmon->pertag->curtag = 0;
|
||||||
}
|
}
|
||||||
/* test if the user did not select the same tag */
|
/* test if the user did not select the same tag */
|
||||||
if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
|
if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
|
||||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
|
||||||
for (i = 0; !(newtagset & 1 << i); i++) ;
|
for (i = 0; !(newtagset & 1 << i); i++) ;
|
||||||
selmon->pertag->curtag = i + 1;
|
selmon->pertag->curtag = i + 1;
|
||||||
}
|
}
|
||||||
@ -4908,11 +4906,10 @@ view(const Arg *arg)
|
|||||||
tagpreviewswitchtag();
|
tagpreviewswitchtag();
|
||||||
#endif // BAR_TAGPREVIEW_PATCH
|
#endif // BAR_TAGPREVIEW_PATCH
|
||||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||||
#if PERTAG_PATCH
|
|
||||||
pertagview(arg);
|
|
||||||
#else
|
|
||||||
if (arg->ui & TAGMASK)
|
if (arg->ui & TAGMASK)
|
||||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||||
|
#if PERTAG_PATCH
|
||||||
|
pertagview(arg);
|
||||||
#endif // PERTAG_PATCH
|
#endif // PERTAG_PATCH
|
||||||
#if TAGSYNC_PATCH
|
#if TAGSYNC_PATCH
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
struct Pertag {
|
struct Pertag {
|
||||||
unsigned int curtag, prevtag; /* current and previous tag */
|
unsigned int curtag; /* current tag index */
|
||||||
int nmasters[NUMTAGS + 1]; /* number of windows in master area */
|
int nmasters[NUMTAGS + 1]; /* number of windows in master area */
|
||||||
#if FLEXTILE_DELUXE_LAYOUT
|
#if FLEXTILE_DELUXE_LAYOUT
|
||||||
int nstacks[NUMTAGS + 1]; /* number of windows in primary stack area */
|
int nstacks[NUMTAGS + 1]; /* number of windows in primary stack area */
|
||||||
@ -29,10 +29,7 @@ void
|
|||||||
pertagview(const Arg *arg)
|
pertagview(const Arg *arg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned int tmptag;
|
|
||||||
if (arg->ui & TAGMASK) {
|
|
||||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
|
||||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
|
||||||
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
|
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
|
||||||
if (arg->ui == ~SPTAGMASK)
|
if (arg->ui == ~SPTAGMASK)
|
||||||
#else
|
#else
|
||||||
@ -40,14 +37,10 @@ pertagview(const Arg *arg)
|
|||||||
#endif // SCRATCHPADS_PATCH
|
#endif // SCRATCHPADS_PATCH
|
||||||
selmon->pertag->curtag = 0;
|
selmon->pertag->curtag = 0;
|
||||||
else {
|
else {
|
||||||
for (i = 0; !(arg->ui & 1 << i); i++) ;
|
for (i = 0; !(selmon->tagset[selmon->seltags] & 1 << i); i++);
|
||||||
selmon->pertag->curtag = i + 1;
|
selmon->pertag->curtag = i + 1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
tmptag = selmon->pertag->prevtag;
|
|
||||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
|
||||||
selmon->pertag->curtag = tmptag;
|
|
||||||
}
|
|
||||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||||
#if FLEXTILE_DELUXE_LAYOUT
|
#if FLEXTILE_DELUXE_LAYOUT
|
||||||
selmon->nstack = selmon->pertag->nstacks[selmon->pertag->curtag];
|
selmon->nstack = selmon->pertag->nstacks[selmon->pertag->curtag];
|
||||||
|
Loading…
Reference in New Issue
Block a user