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.

68 lines
1.7 KiB

  1. void
  2. maximize(int x, int y, int w, int h)
  3. {
  4. XEvent ev;
  5. if (!selmon->sel || selmon->sel->isfixed)
  6. return;
  7. XRaiseWindow(dpy, selmon->sel->win);
  8. if (!selmon->sel->ismax) {
  9. if (!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating)
  10. selmon->sel->wasfloating = True;
  11. else {
  12. togglefloating(NULL);
  13. selmon->sel->wasfloating = False;
  14. }
  15. selmon->sel->oldx = selmon->sel->x;
  16. selmon->sel->oldy = selmon->sel->y;
  17. selmon->sel->oldw = selmon->sel->w;
  18. selmon->sel->oldh = selmon->sel->h;
  19. resize(selmon->sel, x, y, w, h, True);
  20. selmon->sel->ismax = True;
  21. }
  22. else {
  23. resize(selmon->sel, selmon->sel->oldx, selmon->sel->oldy, selmon->sel->oldw, selmon->sel->oldh, True);
  24. if (!selmon->sel->wasfloating)
  25. togglefloating(NULL);
  26. selmon->sel->ismax = False;
  27. }
  28. drawbar(selmon);
  29. while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
  30. }
  31. #if SETBORDERPX_PATCH
  32. void
  33. togglemax(const Arg *arg)
  34. {
  35. maximize(selmon->wx, selmon->wy, selmon->ww - 2 * selmon->borderpx, selmon->wh - 2 * selmon->borderpx);
  36. }
  37. void
  38. toggleverticalmax(const Arg *arg)
  39. {
  40. maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh - 2 * selmon->borderpx);
  41. }
  42. void
  43. togglehorizontalmax(const Arg *arg)
  44. {
  45. maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * selmon->borderpx, selmon->sel->h);
  46. }
  47. #else
  48. void
  49. togglemax(const Arg *arg)
  50. {
  51. maximize(selmon->wx, selmon->wy, selmon->ww - 2 * borderpx, selmon->wh - 2 * borderpx);
  52. }
  53. void
  54. toggleverticalmax(const Arg *arg)
  55. {
  56. maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh - 2 * borderpx);
  57. }
  58. void
  59. togglehorizontalmax(const Arg *arg)
  60. {
  61. maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * borderpx, selmon->sel->h);
  62. }
  63. #endif // SETBORDERPX_PATCH