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.

79 lines
1.4 KiB

18 years ago
18 years ago
18 years ago
18 years ago
  1. /* See LICENSE file for copyright and license details. */
  2. #include "dwm.h"
  3. #include <stdio.h>
  4. /* static */
  5. static double mwfact = MWFACT;
  6. /* extern */
  7. void
  8. addtomwfact(const char *arg) {
  9. double delta;
  10. if(!isarrange(tile))
  11. return;
  12. /* arg handling, manipulate mwfact */
  13. if(arg && (1 == sscanf(arg, "%lf", &delta))) {
  14. if(delta + mwfact > 0.1 && delta + mwfact < 0.9)
  15. mwfact += delta;
  16. }
  17. arrange();
  18. }
  19. void
  20. tile(void) {
  21. unsigned int i, n, nx, ny, nw, nh, mw, th;
  22. Client *c;
  23. for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
  24. n++;
  25. /* window geoms */
  26. mw = (n == 1) ? waw : mwfact * waw;
  27. th = (n > 1) ? wah / (n - 1) : 0;
  28. if(n > 1 && th < bh)
  29. th = wah;
  30. nx = wax;
  31. ny = way;
  32. for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) {
  33. c->ismax = False;
  34. if(i == 0) { /* master */
  35. nw = mw - 2 * c->border;
  36. nh = wah - 2 * c->border;
  37. }
  38. else { /* tile window */
  39. if(i == 1) {
  40. ny = way;
  41. nx += mw;
  42. }
  43. nw = waw - mw - 2 * c->border;
  44. if(i + 1 == n) /* remainder */
  45. nh = (way + wah) - ny - 2 * c->border;
  46. else
  47. nh = th - 2 * c->border;
  48. }
  49. resize(c, nx, ny, nw, nh, False);
  50. if(n > 1 && th != wah)
  51. ny += nh + 2 * c->border;
  52. i++;
  53. }
  54. }
  55. void
  56. zoom(const char *arg) {
  57. Client *c;
  58. if(!sel || !isarrange(tile) || sel->isfloating)
  59. return;
  60. if((c = sel) == nexttiled(clients))
  61. if(!(c = nexttiled(c->next)))
  62. return;
  63. detach(c);
  64. attach(c);
  65. focus(c);
  66. arrange();
  67. }