layout_facts.c (1545B)
1 #if CFACTS_PATCH 2 void 3 getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr) 4 { 5 unsigned int n; 6 float mfacts = 0, sfacts = 0; 7 int mtotal = 0, stotal = 0; 8 Client *c; 9 10 for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) 11 if (n < m->nmaster) 12 mfacts += c->cfact; 13 else 14 sfacts += c->cfact; 15 16 for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) 17 if (n < m->nmaster) 18 mtotal += msize * (c->cfact / mfacts); 19 else 20 stotal += ssize * (c->cfact / sfacts); 21 22 *mf = mfacts; // total factor of master area 23 *sf = sfacts; // total factor of stack area 24 *mr = msize - mtotal; // the remainder (rest) of pixels after a cfacts master split 25 *sr = ssize - stotal; // the remainder (rest) of pixels after a cfacts stack split 26 } 27 #else 28 void 29 getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr) 30 { 31 unsigned int n; 32 float mfacts, sfacts; 33 int mtotal = 0, stotal = 0; 34 Client *c; 35 36 for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); 37 mfacts = MIN(n, m->nmaster); 38 sfacts = n - m->nmaster; 39 40 for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) 41 if (n < m->nmaster) 42 mtotal += msize / mfacts; 43 else 44 stotal += ssize / sfacts; 45 46 *mf = mfacts; // total factor of master area 47 *sf = sfacts; // total factor of stack area 48 *mr = msize - mtotal; // the remainder (rest) of pixels after an even master split 49 *sr = ssize - stotal; // the remainder (rest) of pixels after an even stack split 50 } 51 #endif // CFACTS_PATCH 52