Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.5 KiB

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