by James Turner:
3rd version:
On 7/15/07, Alessandro Dotti Contra <[EMAIL PROTECTED]> wrote:
On Sun, Jul 15, 2007 at 09:34:01AM +0200, Christian Garbs wrote:
|
|Where did you get the bottom stack patch for 4.2?
It was attached to a mail (by James Turner) posted to this list.
ciao
alex
--
Alessandro Dotti Contra | email: [EMAIL PROTECTED]
Bologna, Italy | PGP Key ID: 0x9C84C3DA
http://www.hyboria.org/ | jabber: [EMAIL PROTECTED]
| gtalk: [EMAIL PROTECTED]
--- layout.c Wed May 30 06:20:42 2007
+++ layout.c Sat Jun 16 15:57:05 2007
@@ -28,7 +28,7 @@ unban(Client *c) {
}
static void
-tile(void) {
+_tile(const Bool right) {
unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
Client *c;
@@ -49,6 +49,8 @@ tile(void) {
nx = wax;
ny = way;
if(i < nmaster) {
+ if(!right)
+ nx += tw;
ny += i * mh;
nw = mw - 2 * c->border;
nh = mh;
@@ -57,7 +59,8 @@ tile(void) {
nh -= 2 * c->border;
}
else { /* tile window */
- nx += mw;
+ if(right)
+ nx += mw;
nw = tw - 2 * c->border;
if(th > 2 * c->border) {
ny += (i - nmaster) * th;
@@ -78,6 +81,80 @@ tile(void) {
restack();
}
+static void
+_bstack(const Bool portrait) {
+ unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
+ Client *c;
+
+ for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
+ n++;
+ /* window geoms */
+ mh = (n > nmaster) ? ((wah * masterw) / 1000) / nmaster : wah / (n > 0 ? n :
1);
+ mw = waw;
+ th = (n > nmaster) ? ((wah * (1000 - masterw)) / 1000) / (portrait ? 1 : n -
nmaster) : 0;
+ tw = (n > nmaster) ? waw / (portrait ? n - nmaster : 1) : 0;
+
+ for(i = 0, c = clients; c; c = c->next)
+ if(isvisible(c)) {
+ unban(c);
+ if(c->isfloating)
+ continue;
+ c->ismax = False;
+ nx = wax;
+ ny = way;
+ if(i < nmaster) {
+ ny += i * mh;
+ nw = mw - 2 * c->border;
+ nh = mh - 2 * c->border;
+ }
+ else if(portrait) { /* portrait bstack tiles */
+ nx += (i - nmaster) * tw;
+ ny += mh * nmaster;
+ nw = tw - 2 * c->border;
+ nh = th - 2 * c->border + 1;
+ } else { /* landscape bstack tiles */
+ ny += mh * nmaster;
+ nw = tw - 2 * c->border;
+ if(th > 2 * c->border) {
+ ny += (i - nmaster) * th;
+ nh = th - 2 * c->border;
+ if (i == n - 1)
+ nh += (n > nmaster) ? wah - mh - th * (n - nmaster) : 0;
+ }
+ else /* fallback if th <= 2 * c->border */
+ nh = wah - 2 * c->border;
+ }
+ resize(c, nx, ny, nw, nh, False);
+ i++;
+ }
+ else {
+ ban(c);
+ }
+ if(!sel || !isvisible(sel))
+ focus(c);
+ restack();
+}
+
+static void
+tile(void) {
+ _tile(True);
+}
+
+static void
+tileleft(void) {
+ _tile(False);
+}
+
+static void
+bstackportrait(void) {
+ _bstack(True);
+}
+
+static void
+bstacklandscape(void) {
+ _bstack(False);
+}
+
LAYOUTS
/* extern */
@@ -126,7 +203,7 @@ focusclient(const char *arg) {
void
incmasterw(const char *arg) {
int i;
- if(lt->arrange != tile)
+ if(lt->arrange == floating)
return;
if(!arg)
masterw = MASTERWIDTH;
@@ -148,7 +225,7 @@ incnmaster(const char *arg) {
nmaster = NMASTER;
else {
i = atoi(arg);
- if((lt->arrange != tile) || (nmaster + i < 1)
+ if((lt->arrange == floating) || (nmaster + i < 1)
|| (wah / (nmaster + i) <= 2 * BORDERPX))
return;
nmaster += i;
--- config.default.h Wed May 30 06:20:42 2007
+++ config.default.h Fri Jun 15 23:03:30 2007
@@ -29,6 +29,9 @@ static Rule rule[] = { \
static Layout layout[] = { \
/* symbol function */ \
{ "[]=", tile }, /* first entry is default */ \
+ { "=[]", tileleft }, \
+ { "TTT", bstackportrait }, \
+ { "===", bstacklandscape }, \
{ "><>", floating }, \
};
#define MASTERWIDTH 600 /* master width per thousand */