tstack.c 948 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. static void tstack(void)
  2. {
  3. unsigned int i, n, nx, ny, nw, nh, m, mw, mh, tw;
  4. Client *c;
  5. for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
  6. if (!c->minimized)
  7. n++;
  8. m = MAX(1, MIN(n, screen.nmaster));
  9. mh = n == m ? wah : screen.mfact * wah;
  10. mw = waw / m;
  11. tw = n == m ? 0 : waw / (n - m);
  12. nx = wax;
  13. ny = way + wah - mh;
  14. for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
  15. if (c->minimized)
  16. continue;
  17. if (i < m) { /* master */
  18. if (i > 0) {
  19. mvvline(ny, nx, ACS_VLINE, nh);
  20. mvaddch(ny, nx, ACS_TTEE);
  21. nx++;
  22. }
  23. nh = mh;
  24. nw = (i < m - 1) ? mw : (wax + waw) - nx;
  25. } else { /* tile window */
  26. if (i == m) {
  27. nx = wax;
  28. ny = way;
  29. nh = (way + wah) - ny - mh;
  30. }
  31. if (i > m) {
  32. mvvline(ny, nx, ACS_VLINE, nh);
  33. mvaddch(ny, nx, ACS_TTEE);
  34. nx++;
  35. }
  36. nw = (i < n - 1) ? tw : (wax + waw) - nx;
  37. }
  38. resize(c, nx, ny, nw, nh);
  39. nx += nw;
  40. i++;
  41. }
  42. }