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.

54 lines
1.4 KiB

  1. void
  2. centeredfloatingmaster(Monitor *m)
  3. {
  4. unsigned int i, n;
  5. float mfacts, sfacts;
  6. int mrest, srest;
  7. int mx = 0, my = 0, mh = 0, mw = 0;
  8. int sx = 0, sy = 0, sh = 0, sw = 0;
  9. Client *c;
  10. float mivf = 1.0; // master inner vertical gap factor
  11. int oh, ov, ih, iv;
  12. getgaps(m, &oh, &ov, &ih, &iv, &n);
  13. if (n == 0)
  14. return;
  15. sx = mx = m->wx + ov;
  16. sy = my = m->wy + oh;
  17. sh = mh = m->wh - 2*oh;
  18. mw = m->ww - 2*ov - iv*(n - 1);
  19. sw = m->ww - 2*ov - iv*(n - m->nmaster - 1);
  20. if (m->nmaster && n > m->nmaster) {
  21. mivf = 0.8;
  22. /* go mfact box in the center if more than nmaster clients */
  23. if (m->ww > m->wh) {
  24. mw = m->ww * m->mfact - iv*mivf*(MIN(n, m->nmaster) - 1);
  25. mh = m->wh * 0.9;
  26. } else {
  27. mw = m->ww * 0.9 - iv*mivf*(MIN(n, m->nmaster) - 1);
  28. mh = m->wh * m->mfact;
  29. }
  30. mx = m->wx + (m->ww - mw) / 2;
  31. my = m->wy + (m->wh - mh - 2*oh) / 2;
  32. sx = m->wx + ov;
  33. sy = m->wy + oh;
  34. sh = m->wh - 2*oh;
  35. }
  36. getfacts(m, mw, sw, &mfacts, &sfacts, &mrest, &srest);
  37. for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
  38. if (i < m->nmaster) {
  39. /* nmaster clients are stacked horizontally, in the center of the screen */
  40. resize(c, mx, my, (mw / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
  41. mx += WIDTH(c) + iv*mivf;
  42. } else {
  43. /* stack clients are stacked horizontally */
  44. resize(c, sx, sy, (sw / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
  45. sx += WIDTH(c) + iv;
  46. }
  47. }