[wiki] [sites] improved smfact: no more crashing, clients now appear floating center || Unia

From: <git_AT_suckless.org>
Date: Sat, 06 Apr 2013 21:13:56 +0200

commit 10c6e4d4a73ddf2bd646b91e3fa2b116f0aa2bec
Author: Unia <jthidskes_AT_live.nl>
Date: Sat Apr 6 21:14:14 2013 +0200

    improved smfact: no more crashing, clients now appear floating center

diff --git a/dwm.suckless.org/patches/dwm-6.0-smfact.diff b/dwm.suckless.org/patches/dwm-6.0-smfact.diff
index 52880cd..2032ef0 100644
--- a/dwm.suckless.org/patches/dwm-6.0-smfact.diff
+++ b/dwm.suckless.org/patches/dwm-6.0-smfact.diff
_AT_@ -1,5 +1,5 @@
---- config.def.h.orig 2013-03-28 17:38:07.683304594 +0100
-+++ config.def.h 2013-03-28 17:39:22.049970008 +0100
+--- config.def.h 2013-04-06 21:01:27.750829760 +0200
++++ config.def.h 2013-04-06 21:02:19.557495556 +0200
 _AT_@ -10,6 +10,7 @@ static const char selbgcolor[] = "#
  static const char selfgcolor[] = "#eeeeee";
  static const unsigned int borderpx = 1; /* border pixel of windows */
_AT_@ -25,8 +25,8 @@
          { MODKEY, XK_Return, zoom, {0} },
          { MODKEY, XK_Tab, view, {0} },
          { MODKEY|ShiftMask, XK_c, killclient, {0} },
---- src/dwm-6.0/dwm.c 2011-12-19 16:02:46.000000000 +0100
-+++ dwm.c 2013-03-28 17:43:09.233299524 +0100
+--- dwm.c 2011-12-19 16:02:46.000000000 +0100
++++ dwm.c 2013-04-06 21:00:46.620830452 +0200
 _AT_@ -69,6 +69,7 @@ typedef union {
          int i;
          unsigned int ui;
_AT_@ -51,7 +51,15 @@
  static void setup(void);
  static void showhide(Client *c);
  static void sigchld(int unused);
-_AT_@ -1581,6 +1584,19 @@ setmfact(const Arg *arg) {
+_AT_@ -651,6 +654,7 @@ createmon(void) {
+ die("fatal: could not malloc() %u bytes
", sizeof(Monitor));
+ m->tagset[0] = m->tagset[1] = 1;
+ m->mfact = mfact;
++ m->smfact = smfact;
+ m->nmaster = nmaster;
+ m->showbar = showbar;
+ m->topbar = topbar;
+_AT_@ -1581,6 +1585,19 @@ setmfact(const Arg *arg) {
  }
  
  void
_AT_@ -60,10 +68,10 @@
 +
 + if(!arg || !selmon->lt[selmon->sellt]->arrange)
 + return;
-+ sf = arg->sf < 1.0 ? arg->sf + selmon->smfacts[selmon->curtag] : arg->sf - 1.0;
++ sf = arg->sf < 1.0 ? arg->sf + selmon->smfact : arg->sf - 1.0;
 + if(sf < 0 || sf > 0.9)
 + return;
-+ selmon->smfacts[selmon->curtag] = sf;
++ selmon->smfact = sf;
 + arrange(selmon);
 +}
 +
_AT_@ -71,7 +79,7 @@
  setup(void) {
          XSetWindowAttributes wa;
  
-_AT_@ -1703,7 +1719,7 @@ textnw(const char *text, unsigned int le
+_AT_@ -1703,7 +1720,7 @@ textnw(const char *text, unsigned int le
  
  void
  tile(Monitor *m) {
_AT_@ -80,20 +88,24 @@
          Client *c;
  
          for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
-_AT_@ -1721,9 +1737,19 @@ tile(Monitor *m) {
+_AT_@ -1721,9 +1738,23 @@ tile(Monitor *m) {
                          my += HEIGHT(c);
                  }
                  else {
 - h = (m->wh - ty) / (n - i);
 - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
 - ty += HEIGHT(c);
-+ smh = m->mh * m->smfacts[m->curtag];
++ smh = m->mh * m->smfact;
 + if(!(nexttiled(c->next)))
 + h = (m->wh - ty) / (n - i);
 + else
 + h = (m->wh - smh - ty) / (n - i);
-+ if(h < minwsz)
++ if(h < minwsz) {
 + c->isfloating = True;
++ XRaiseWindow(dpy, c->win);
++ resize(c, m->mx + (m->mw / 2 - WIDTH(c) / 2), m->my + (m->mh / 2 - HEIGHT(c) / 2), m->ww - mw - (2*c->bw), h - (2*c->bw), False);
++ ty -= HEIGHT(c);
++ }
 + else
 + resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
 + if(!(nexttiled(c->next)))
diff --git a/dwm.suckless.org/patches/stackmfact.md b/dwm.suckless.org/patches/stackmfact.md
index f902890..0ec5a38 100644
--- a/dwm.suckless.org/patches/stackmfact.md
+++ b/dwm.suckless.org/patches/stackmfact.md
_AT_@ -29,11 +29,6 @@ Description
         | | |
         +-----------------+-------+
 
-Issues
-------
-* with more than X clients, increasing smfact too much will crash DWM.
-* negative smfact can't properly function in the way smfact is implemented.
-
 Download
 --------
 * [dwm-6.0-smfact.diff](dwm-6.0-smfact.diff)
Received on Sat Apr 06 2013 - 21:13:56 CEST

This archive was generated by hypermail 2.3.0 : Sat Apr 06 2013 - 21:24:13 CEST