[wiki] [sites] [dwm][patch] cfacts layouts updated to prevent crash with 50+ clients || Aaron Duxler

From: <git_AT_suckless.org>
Date: Sat, 25 Apr 2020 16:31:13 +0200

commit 27b687e07ab67edabc68639a46e55ca25a3708e3
Author: Aaron Duxler <aaron_AT_duxler.xyz>
Date: Sat Apr 25 16:31:10 2020 +0200

    [dwm][patch] cfacts layouts updated to prevent crash with 50+ clients

diff --git a/dwm.suckless.org/patches/cfacts/dwm-cfacts_bottomstack-6.2.diff b/dwm.suckless.org/patches/cfacts/dwm-cfacts_bottomstack-6.2.diff
index 3b297805..c4365dab 100644
--- a/dwm.suckless.org/patches/cfacts/dwm-cfacts_bottomstack-6.2.diff
+++ b/dwm.suckless.org/patches/cfacts/dwm-cfacts_bottomstack-6.2.diff
_AT_@ -34,7 +34,7 @@ diff -up a/dwm.c b/dwm.c
  
  /* variables */
  static const char broken[] = "broken";
-_AT_@ -2175,3 +2177,83 @@ main(int argc, char *argv[])
+_AT_@ -2175,3 +2177,87 @@ main(int argc, char *argv[])
          XCloseDisplay(dpy);
          return EXIT_SUCCESS;
  }
_AT_@ -68,12 +68,14 @@ diff -up a/dwm.c b/dwm.c
 + if (i < m->nmaster) {
 + w = (m->ww - mx) * (c->cfact / mfacts);
 + resize(c, m->wx + mx, m->wy, w - (2*c->bw), mh - 2*c->bw, 0);
-+ mx += WIDTH(c);
++ if(mx + WIDTH(c) < m->mw)
++ mx += WIDTH(c);
 + mfacts -= c->cfact;
 + } else {
 + w = (m->ww - tx) * (c->cfact / sfacts);
 + resize(c, m->wx + tx, m->wy + mh, w - (2*c->bw), m->wh - mh - 2*(c->bw), 0);
-+ tx += WIDTH(c);
++ if(tx + WIDTH(c) < m->mw)
++ tx += WIDTH(c);
 + sfacts -= c->cfact;
 + }
 +}
_AT_@ -109,12 +111,14 @@ diff -up a/dwm.c b/dwm.c
 + if (i < m->nmaster) {
 + h = (mh - my) * (c->cfact / mfacts);
 + resize(c, m->wx, m->wy + my, mw - 2*c->bw, h - 2*c->bw, 0);
-+ my += HEIGHT(c);
++ if(my + HEIGHT(c) < m->mh)
++ my += HEIGHT(c);
 + mfacts -= c->cfact;
 + } else {
 + h = (m->wh - mh - ty) * (c->cfact / sfacts);
 + resize(c, m->wx, m->wy + mh + ty, mw - 2*c->bw, h - (2*c->bw), 0);
-+ ty += HEIGHT(c);
++ if(ty + HEIGHT(c) < m->mh)
++ ty += HEIGHT(c);
 + sfacts -= c->cfact;
 + }
 +}
diff --git a/dwm.suckless.org/patches/cfacts/dwm-cfacts_centeredmaster-6.2.diff b/dwm.suckless.org/patches/cfacts/dwm-cfacts_centeredmaster-6.2.diff
index e76fc45c..9a00b08e 100644
--- a/dwm.suckless.org/patches/cfacts/dwm-cfacts_centeredmaster-6.2.diff
+++ b/dwm.suckless.org/patches/cfacts/dwm-cfacts_centeredmaster-6.2.diff
_AT_@ -33,7 +33,7 @@ diff -up a/dwm.c b/dwm.c
  
  /* variables */
  static const char broken[] = "broken";
-_AT_@ -2175,3 +2177,139 @@ main(int argc, char *argv[])
+_AT_@ -2175,3 +2177,144 @@ main(int argc, char *argv[])
          XCloseDisplay(dpy);
          return EXIT_SUCCESS;
  }
_AT_@ -89,7 +89,8 @@ diff -up a/dwm.c b/dwm.c
 + h = (m->wh - my) * (c->cfact / mfacts);
 + resize(c, m->wx + mx, m->wy + my, mw - 2*c->bw,
 + h - 2*c->bw, 0);
-+ my += HEIGHT(c);
++ if(my + HEIGHT(c) < m->mh)
++ my += HEIGHT(c);
 + mfacts -= c->cfact;
 + } else {
 + /* stack clients are stacked vertically */
_AT_@ -101,13 +102,15 @@ diff -up a/dwm.c b/dwm.c
 + else
 + resize(c, m->wx, m->wy + ety, tw - 2*c->bw,
 + h - 2*c->bw, 0);
-+ ety += HEIGHT(c);
++ if(ety + HEIGHT(c) < m->mh)
++ ety += HEIGHT(c);
 + lfacts -= c->cfact;
 + } else {
 + h = (m->wh - oty) * (c->cfact / rfacts);
 + resize(c, m->wx + mx + mw, m->wy + oty,
 + tw - 2*c->bw, h - 2*c->bw, 0);
-+ oty += HEIGHT(c);
++ if(oty + HEIGHT(c) < m->mh)
++ oty += HEIGHT(c);
 + rfacts -= c->cfact;
 + }
 + }
_AT_@ -162,14 +165,16 @@ diff -up a/dwm.c b/dwm.c
 + w = (mw + mxo - mx) * (c->cfact / mfacts);
 + resize(c, m->wx + mx, m->wy + my, w - 2*c->bw,
 + mh - 2*c->bw, 0);
-+ mx += WIDTH(c);
++ if(mx + WIDTH(c) < m->mw)
++ mx += WIDTH(c);
 + mfacts -= c->cfact;
 + } else {
 + /* stack clients are stacked horizontally */
 + w = (m->ww - tx) * (c->cfact / sfacts);
 + resize(c, m->wx + tx, m->wy, w - 2*c->bw,
 + m->wh - 2*c->bw, 0);
-+ tx += WIDTH(c);
++ if(tx + WIDTH(c) < m->mw)
++ tx += WIDTH(c);
 + sfacts -= c->cfact;
 + }
 +}
Received on Sat Apr 25 2020 - 16:31:13 CEST

This archive was generated by hypermail 2.3.0 : Sat Apr 25 2020 - 16:36:49 CEST