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.

72 lines
1.8 KiB

  1. static void
  2. tile(Monitor *m)
  3. {
  4. unsigned int i, n;
  5. int mx = 0, my = 0, mh = 0, mw = 0;
  6. int sx = 0, sy = 0, sh = 0, sw = 0;
  7. float mfacts, sfacts;
  8. int mrest, srest;
  9. Client *c;
  10. #if VANITYGAPS_PATCH
  11. int oh, ov, ih, iv;
  12. getgaps(m, &oh, &ov, &ih, &iv, &n);
  13. #else
  14. for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
  15. #endif // VANITYGAPS_PATCH
  16. if (n == 0)
  17. return;
  18. #if VANITYGAPS_PATCH
  19. sx = mx = m->wx + ov;
  20. sy = my = m->wy + oh;
  21. mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
  22. sh = m->wh - 2*oh - ih * (n - m->nmaster - 1);
  23. sw = mw = m->ww - 2*ov;
  24. if (m->nmaster && n > m->nmaster) {
  25. sw = (mw - iv) * (1 - m->mfact);
  26. mw = (mw - iv) * m->mfact;
  27. sx = mx + mw + iv;
  28. }
  29. #else
  30. sx = mx = m->wx;
  31. sy = my = m->wy;
  32. sh = mh = m->wh;
  33. sw = mw = m->ww;
  34. if (m->nmaster && n > m->nmaster) {
  35. sw = mw * (1 - m->mfact);
  36. mw = mw * m->mfact;
  37. sx = mx + mw;
  38. }
  39. #endif // VANITYGAPS_PATCH
  40. getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
  41. for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
  42. if (i < m->nmaster) {
  43. #if CFACTS_PATCH
  44. resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) * c->cfact + (i < mrest ? 1 : 0) - (2*c->bw), 0);
  45. #else
  46. resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
  47. #endif // CFACTS_PATCH
  48. #if VANITYGAPS_PATCH
  49. my += HEIGHT(c) + ih;
  50. #else
  51. my += HEIGHT(c);
  52. #endif
  53. } else {
  54. #if CFACTS_PATCH
  55. resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) * c->cfact + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
  56. #else
  57. resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
  58. #endif // CFACTS_PATCH
  59. #if VANITYGAPS_PATCH
  60. sy += HEIGHT(c) + ih;
  61. #else
  62. sy += HEIGHT(c);
  63. #endif
  64. }
  65. }