dwm-flexipatch/patch/cfacts.c

38 lines
796 B
C
Raw Normal View History

void
2019-09-09 19:35:19 +00:00
setcfact(const Arg *arg)
{
float f;
Client *c;
c = selmon->sel;
if (!arg || !c || !selmon->lt[selmon->sellt]->arrange)
return;
f = arg->f + c->cfact;
if (arg->f == 0.0)
f = 1.0;
else if (f < 0.25 || f > 4.0)
return;
c->cfact = f;
arrange(selmon);
2019-09-09 17:11:31 +00:00
}
2020-01-15 12:21:56 +00:00
#if BSTACK_LAYOUT || BSTACKHORIZ_LAYOUT || CENTEREDMASTER_LAYOUT || CENTEREDFLOATINGMASTER_LAYOUT || COLUMNS_LAYOUT || DECK_LAYOUT || TILE_LAYOUT
2019-09-09 17:11:31 +00:00
void
getfacts(Monitor *m, float *mf, float *sf)
{
2019-09-09 19:35:19 +00:00
unsigned int n;
2019-09-09 17:11:31 +00:00
float mfacts = 0, sfacts = 0;
Client *c;
2019-09-09 19:35:19 +00:00
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
2019-09-09 17:11:31 +00:00
if (!m->nmaster || n < m->nmaster)
mfacts += c->cfact;
else
sfacts += c->cfact;
}
*mf = mfacts; // total factor of master area
*sf = sfacts; // total factor of slave area
}
#endif