All pastes #609668 Raw Edit

Something

public text v1 · immutable
·published 2007-07-09 00:42 UTC
rendered paste body
diff -up dwm-4.2/client.c dwm009/client.c
--- dwm-4.2/client.c	2007-05-30 07:20:42.000000000 -0300
+++ dwm009/client.c	2007-07-08 19:42:17.000000000 -0300
@@ -221,6 +221,7 @@ manage(Window w, XWindowAttributes *wa) 
 	XMapWindow(dpy, w);
 	setclientstate(c, NormalState);
 	focus(c);
+	/* incfocusedtilew("reset"); */
 	lt->arrange();
 }
 
@@ -398,5 +399,7 @@ unmanage(Client *c) {
 	XSync(dpy, False);
 	XSetErrorHandler(xerror);
 	XUngrabServer(dpy);
+/*	incfocusedtilew("reset"); */
+	
 	lt->arrange();
 }
Only in dwm009: client.o
diff -up dwm-4.2/config.default.h dwm009/config.default.h
--- dwm-4.2/config.default.h	2007-05-30 07:20:42.000000000 -0300
+++ dwm009/config.default.h	2007-07-08 19:37:23.000000000 -0300
@@ -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 */
Only in dwm009: config.h
Only in dwm009: draw.o
Only in dwm009: dwm
diff -up dwm-4.2/dwm.h dwm009/dwm.h
--- dwm-4.2/dwm.h	2007-05-30 07:20:42.000000000 -0300
+++ dwm009/dwm.h	2007-07-05 16:28:18.000000000 -0300
@@ -121,6 +121,7 @@ void floating(void);			/* arranges all w
 void focusclient(const char *arg);	/* focuses next(1)/previous(-1) visible client */
 void incmasterw(const char *arg);	/* increments the master width with arg's index value */
 void incnmaster(const char *arg);	/* increments nmaster with arg's index value */
+void incfocusedtilew(const char *arg);	/* increments focused tile width with arg's index value */
 void initlayouts(void);			/* initialize layout array */
 Client *nexttiled(Client *c);		/* returns tiled successor of c */
 void restack(void);			/* restores z layers of all clients */
Only in dwm009: event.o
diff -up dwm-4.2/layout.c dwm009/layout.c
--- dwm-4.2/layout.c	2007-05-30 07:20:42.000000000 -0300
+++ dwm009/layout.c	2007-07-08 19:39:36.000000000 -0300
@@ -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,180 @@ tile(void) {
 	restack();
 }
 
+// array com os ajustes de largura para cada janela
+#define numero_maximo_de_janelas 1000
+int nxadjust[numero_maximo_de_janelas];
+int nxadjustset = 0;
+int lastwindow = 0;
+
+
+void
+incfocusedtilew(const char *arg) 
+{
+	int i;
+	int newadj;
+	Client *c;
+
+	//if(!arg)return;
+	
+	/* reseta os ajustes de largura para padrao*/
+	if(arg == "reset")
+	{
+		/*if(nxadjustset == 0) printf("Initializing nxadjust array...\n");
+		else	printf("Resetting nxadjust array...\n");*/
+
+		for(i = 0;i < numero_maximo_de_janelas;i++) 
+		{
+			nxadjust[i] = 0;
+			
+		}
+		return;	
+	}
+	/* arg e um numero, entao descobrir qual o numero da janela focada e botar o ajuste no array */
+	
+	newadj = atoi(arg);
+	for(i = 0, c = clients; c; c = c->next)
+	{
+		if(c == sel)
+		{
+			/*printf("Adjusting the width of the focused window by %i pixels...",newadj);
+			printf("The window being adjusted is the number: %i",i); */
+			nxadjust[i] += newadj;
+			lt->arrange();
+			return;
+		}
+		i++;
+	}
+    
+}
+
+void GetLastWindowNumber()
+{
+	int p;
+	Client *c;
+
+	for(p = 0, c = clients; c; c = c->next)
+	{
+		p++;
+	}
+	lastwindow = (p - 1);
+
+}
+
+static void
+_bstack(const Bool portrait) {
+ unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
+ Client *c;
+
+	int beforelastwindow;
+
+ if(nxadjustset == 0)
+ {
+	 // inicializa todos as posicoes do array nxadjust para 0
+	 incfocusedtilew("reset");
+	 nxadjustset = 1;
+ }
+// Pega a ultima janela
+ GetLastWindowNumber();
+// A penultima janela
+ beforelastwindow = (lastwindow - 1);
+
+ 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;
+	   
+	   if(i != 0) nx += nxadjust[i-1];
+	
+       ny += mh * nmaster;
+       nw = tw - 2 * c->border;
+       
+	   if(i != 0 ) nw -= nxadjust[i-1];
+	   
+	   nw += nxadjust[i];
+		
+	
+	   if(nw < 32) nw = 32;
+	   if(i != 0)
+	   {
+			if(i == lastwindow || i == beforelastwindow)
+			{
+		  
+				if(i == lastwindow)  
+				{ 
+					nx -=nxadjust[i]; /*  ltima janela */
+					nw += nxadjust[i];
+				}
+				else
+				{	 
+					nw -=nxadjust[i+1]; /*  a penltima janela */
+		   
+				}
+			}
+	   }
+	   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(NULL);
+ 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 */
@@ -123,10 +300,12 @@ 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 +327,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;
Only in dwm009: layout.o
Only in dwm009: main.o
Only in dwm009: tag.o
Only in dwm009: util.o