commit 440eaa86c1c2d1df006cea31abc41632e78c22c1
parent 2a4388e7420da0c93bea5de3dd6a03835350e5cc
Author: Unia <jthidskes@live.nl>
Date: Thu, 28 Mar 2013 17:46:07 +0100
fix crashing altogether, now clients that would crash go floating
Diffstat:
1 file changed, 39 insertions(+), 30 deletions(-)
diff --git a/dwm.suckless.org/patches/dwm-6.0-smfact.diff b/dwm.suckless.org/patches/dwm-6.0-smfact.diff
@@ -1,5 +1,32 @@
---- dwm.c 2013-03-27 14:12:41.316782003 +0100
-+++ dwm.c 2013-03-27 14:12:49.040115216 +0100
+--- config.def.h.orig 2013-03-28 17:38:07.683304594 +0100
++++ config.def.h 2013-03-28 17:39:22.049970008 +0100
+@@ -10,6 +10,7 @@ static const char selbgcolor[] = "#
+ static const char selfgcolor[] = "#eeeeee";
+ static const unsigned int borderpx = 1; /* border pixel of windows */
+ static const unsigned int snap = 32; /* snap pixel */
++static const unsigned int minwsz = 20; /* Minimal heigt of a client for smfact */
+ static const Bool showbar = True; /* False means no bar */
+ static const Bool topbar = True; /* False means bottom bar */
+
+@@ -24,6 +25,7 @@ static const Rule rules[] = {
+
+ /* layout(s) */
+ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
++static const float smfact = 0.00; /* factor of tiled clients [0.00..0.95] */
+ static const int nmaster = 1; /* number of clients in master area */
+ static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
+
+@@ -60,6 +62,8 @@ static Key keys[] = {
+ { MODKEY, XK_d, incnmaster, {.i = -1 } },
+ { MODKEY, XK_h, setmfact, {.f = -0.05} },
+ { MODKEY, XK_l, setmfact, {.f = +0.05} },
++ { MODKEY|ShiftMask, XK_h, setsmfact, {.f = +0.05} },
++ { MODKEY|ShiftMask, XK_l, setsmfact, {.f = -0.05} },
+ { 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
@@ -69,6 +69,7 @@ typedef union {
int i;
unsigned int ui;
@@ -24,20 +51,17 @@
static void setup(void);
static void showhide(Client *c);
static void sigchld(int unused);
-@@ -1581,6 +1584,22 @@ setmfact(const Arg *arg) {
+@@ -1581,6 +1584,19 @@ setmfact(const Arg *arg) {
}
void
+setsmfact(const Arg *arg) {
+ float sf;
-+ int n = 0;
-+ Client *c;
+
+ if(!arg || !selmon->lt[selmon->sellt]->arrange)
+ return;
+ sf = arg->sf < 1.0 ? arg->sf + selmon->smfacts[selmon->curtag] : arg->sf - 1.0;
-+ for(n = 0, c = nexttiled(selmon->clients); c; c = nexttiled(c->next), n++);
-+ if(sf < 0 || ((n > 7) ? (sf > 0.50) : (sf > 0.95)))
++ if(sf < 0 || sf > 0.9)
+ return;
+ selmon->smfacts[selmon->curtag] = sf;
+ arrange(selmon);
@@ -47,7 +71,7 @@
setup(void) {
XSetWindowAttributes wa;
-@@ -1703,7 +1722,7 @@ textnw(const char *text, unsigned int le
+@@ -1703,7 +1719,7 @@ textnw(const char *text, unsigned int le
void
tile(Monitor *m) {
@@ -56,18 +80,22 @@
Client *c;
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
-@@ -1721,9 +1740,16 @@ tile(Monitor *m) {
+@@ -1721,9 +1737,19 @@ 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];
+ if(!(nexttiled(c->next)))
+ h = (m->wh - ty) / (n - i);
+ else
+ h = (m->wh - smh - 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);
++ if(h < minwsz)
++ c->isfloating = True;
++ else
++ resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
+ if(!(nexttiled(c->next)))
+ ty += HEIGHT(c) + smh;
+ else
@@ -75,22 +103,3 @@
}
}
---- config.def.h 2013-03-27 14:13:01.230115003 +0100
-+++ config.def.h 2013-03-27 14:14:09.156780538 +0100
-@@ -24,6 +24,7 @@ static const Rule rules[] = {
-
- /* layout(s) */
- static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
-+static const float smfact = 0.00; /* factor of tiled clients [0.00..0.95] */
- static const int nmaster = 1; /* number of clients in master area */
- static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
-
-@@ -60,6 +61,8 @@ static Key keys[] = {
- { MODKEY, XK_d, incnmaster, {.i = -1 } },
- { MODKEY, XK_h, setmfact, {.f = -0.05} },
- { MODKEY, XK_l, setmfact, {.f = +0.05} },
-+ { MODKEY|ShiftMask, XK_h, setsmfact, {.f = +0.05} },
-+ { MODKEY|ShiftMask, XK_l, setsmfact, {.f = -0.05} },
- { MODKEY, XK_Return, zoom, {0} },
- { MODKEY, XK_Tab, view, {0} },
- { MODKEY|ShiftMask, XK_c, killclient, {0} },