Update: Implement pertag for gaps (properly this time)
This commit is contained in:
parent
4c6ef24065
commit
160b0f17cf
27
speedwm.c
27
speedwm.c
|
@ -468,6 +468,7 @@ static void incrigaps(const Arg *arg);
|
|||
static void incrogaps(const Arg *arg);
|
||||
static void togglegaps(const Arg *arg);
|
||||
static void defaultgaps(const Arg *arg);
|
||||
static void basegaps(const Arg *arg);
|
||||
static void setlayout(const Arg *arg);
|
||||
#if USEMOUSE
|
||||
static void dragcfact(const Arg *arg);
|
||||
|
@ -716,6 +717,8 @@ struct Pertag {
|
|||
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
|
||||
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
|
||||
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
|
||||
int enablegaps[LENGTH(tags) + 1];
|
||||
unsigned int gaps[LENGTH(tags) + 1];
|
||||
};
|
||||
|
||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||
|
@ -867,6 +870,13 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
|
|||
return *x != c->x || *y != c->y || *w != c->w || *h != c->h;
|
||||
}
|
||||
|
||||
void
|
||||
basegaps(const Arg *arg)
|
||||
{
|
||||
selmon->pertag->enablegaps[selmon->pertag->curtag] = enablegaps;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
arrange(Monitor *m)
|
||||
{
|
||||
|
@ -2649,6 +2659,9 @@ setgaps(int oh, int ov, int ih, int iv)
|
|||
selmon->gappov = ov;
|
||||
selmon->gappih = ih;
|
||||
selmon->gappiv = iv;
|
||||
|
||||
selmon->pertag->gaps[selmon->pertag->curtag] = ((oh & 0xFF) << 0) | ((ov & 0xFF) << 8) | ((ih & 0xFF) << 16) | ((iv & 0xFF) << 24);
|
||||
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
|
@ -2656,11 +2669,7 @@ void
|
|||
getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc)
|
||||
{
|
||||
unsigned int n, oe, ie;
|
||||
#if PERTAG_PATCH
|
||||
oe = ie = selmon->pertag->enablegaps[selmon->pertag->curtag];
|
||||
#else
|
||||
oe = ie = enablegaps;
|
||||
#endif // PERTAG_PATCH
|
||||
oe = ie = m->pertag->enablegaps[m->pertag->curtag];
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
|
@ -2742,7 +2751,7 @@ togglewin(const Arg *arg)
|
|||
void
|
||||
togglegaps(const Arg *arg)
|
||||
{
|
||||
enablegaps = !enablegaps;
|
||||
selmon->pertag->enablegaps[selmon->pertag->curtag] = !selmon->pertag->enablegaps[selmon->pertag->curtag];
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
|
@ -4580,6 +4589,7 @@ setup(void)
|
|||
setupepoll();
|
||||
#endif
|
||||
spawnbar();
|
||||
basegaps(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -5563,6 +5573,11 @@ view(const Arg *arg)
|
|||
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->gappoh = (selmon->pertag->gaps[selmon->pertag->curtag] & 0xff) >> 0;
|
||||
selmon->gappov = (selmon->pertag->gaps[selmon->pertag->curtag] & 0xff00) >> 8;
|
||||
selmon->gappih = (selmon->pertag->gaps[selmon->pertag->curtag] & 0xff0000) >> 16;
|
||||
selmon->gappiv = (selmon->pertag->gaps[selmon->pertag->curtag] & 0xff000000) >> 24;
|
||||
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
||||
togglebar(NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue