ports/116495: [patch] Adding a banch of semi-official patches to x11-wm/dwm

Nikos Ntarmos ntarmos at ceid.upatras.gr
Thu Sep 20 22:20:03 UTC 2007


>Number:         116495
>Category:       ports
>Synopsis:       [patch] Adding a banch of semi-official patches to x11-wm/dwm
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 20 22:20:03 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Nikos Ntarmos
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
NetCInS Lab., C.E.I.D., U. of Patras, Greece
>Environment:
System: FreeBSD ace.netcins.ceid.upatras.gr 7.0-CURRENT FreeBSD 7.0-CURRENT #4: Fri Jul 13 06:50:30 EEST 2007 ntarmos at ace.b020.ceid.upatras.gr:/opt/obj/opt/src/sys/ACE i386


	
>Description:
The attached diff adds a bunch of patches to x11-wm/dwm (v4.4.1), along
with OPTIONS knobs to turn them on and off, also bumping the
PORTREVISION. The included patches are either directly from
dwm.suckless.org (dwm's homepage) or from developers referenced there
(i.e. Gottox and InfinityX), and have been tweaked and/or ported and
tested to build and work together and in various combinations (my
primary desktop is running on an every-patch-included dwm for the last
few weeks without a hitch).
	
>How-To-Repeat:
	
>Fix:

	

--- dwm.new.diff begins here ---
--- Makefile.orig	2007-08-28 13:35:24.000000000 +0300
+++ Makefile	2007-09-20 16:44:18.000000000 +0300
@@ -7,6 +7,7 @@
 
 PORTNAME=	dwm
 PORTVERSION=	4.4.1
+PORTREVISION=	1
 CATEGORIES=	x11-wm
 MASTER_SITES=	http://www.suckless.org/download/ \
 		http://schot.a-eskwadraat.nl/files/
@@ -22,6 +23,16 @@
 PLIST_FILES=	bin/dwm
 PORTDOCS=	LICENSE README
 
+OPTIONS=	BSTACK "Enable BottomStack layout" on \
+		FIBON "Enable Fibonacci layout" on \
+		GRID "Enable Grid layout" on \
+		LWRFLT "Support lowering of floating windows" on \
+		NMSTR "Support multiple clients in the master tile" on \
+		SVEFLT "Support saving of the position of floating windows" on \
+		SNAP "Support snap-to-border" on \
+		PRTAG "Support separate view-per-tag" on \
+		WARP "Support mouse warping" on
+
 pre-everything::
 	@${ECHO_MSG} "You can build dwm with your own config.h using the DWM_CONF knob:"
 	@${ECHO_MSG} "make DWM_CONF=/path/to/dwm/config.h install clean"
@@ -33,6 +44,62 @@
 	@${CP} ${DWM_CONF} ${WRKSRC}/config.h
 .endif
 
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_BSTACK)
+EXTRA_PATCHES+= ${FILESDIR}/extrapatch-bstack
+.endif
+
+.if defined(WITH_FIBON)
+EXTRA_PATCHES+= ${FILESDIR}/extrapatch-fibonacci
+.endif
+
+.if defined(WITH_GRID)
+EXTRA_PATCHES+= ${FILESDIR}/extrapatch-gridmode
+.endif
+
+.if defined(WITH_LWRFLT)
+EXTRA_PATCHES+= ${FILESDIR}/extrapatch-lowerfloat
+.endif
+
+.if defined(WITH_NMSTR)
+EXTRA_PATCHES+= ${FILESDIR}/extrapatch-nmaster
+.endif
+
+.if defined(WITH_SVEFLT)
+EXTRA_PATCHES+= ${FILESDIR}/extrapatch-save_floats
+.endif
+
+.if defined(WITH_SNAP)
+EXTRA_PATCHES+= ${FILESDIR}/extrapatch-snap
+.endif
+
+.if defined(WITH_PRTAG)
+EXTRA_PATCHES+= ${FILESDIR}/extrapatch-taglayouts
+.endif
+
+.if defined(WITH_WARP)
+EXTRA_PATCHES+= ${FILESDIR}/extrapatch-warp
+.endif
+
+post-patch:
+.if defined(WITH_BSTACK)
+	${REINPLACE_CMD} -f ${FILESDIR}/bstack.sed ${WRKSRC}/config.default.h
+	${REINPLACE_CMD} -e 's/!isarrange(tile)/(!isarrange(tile) \&\& !isarrange(bstack))/' ${WRKSRC}/tile.c
+.endif
+.if defined(WITH_FIBON)
+	${REINPLACE_CMD} -e 's/^SRC =.*$$/& fibonacci.c/' ${WRKSRC}/config.mk
+	${REINPLACE_CMD} -f ${FILESDIR}/fibonacci.sed ${WRKSRC}/config.default.h
+	${REINPLACE_CMD} -e 's/!isarrange(tile)/(!isarrange(tile) \&\& !isarrange(dwindle) \&\& !isarrange(spiral)) /' ${WRKSRC}/tile.c
+.endif
+.if defined(WITH_GRID)
+	${REINPLACE_CMD} -e 's/^SRC =.*$$/& grid.c/' ${WRKSRC}/config.mk
+	${SED} -i.bak -f ${FILESDIR}/gridmode.sed ${WRKSRC}/config.default.h
+.endif
+.if defined(WITH_NMSTR)
+	${REINPLACE_CMD} -f ${FILESDIR}/nmaster.sed ${WRKSRC}/config.default.h
+.endif
+
 post-install:
 .if !defined(NOPORTDOCS)
 	@${ECHO_MSG} "installing additional documentation to ${DOCSDIR}"
@@ -41,4 +108,4 @@
 	@${INSTALL_MAN} ${WRKSRC}/README ${DOCSDIR}
 .endif
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/extrapatch-bstack	2007-09-20 16:39:27.000000000 +0300
@@ -0,0 +1,55 @@
+--- /usr/local/src/dwm/dwm-4.4-virgin/tile.c	2007-08-23 19:12:01.000000000 -0400
++++ tile.c	2007-08-24 21:05:05.000000000 -0400
+@@ -71,6 +71,44 @@ tile(void) {
+ }
+ 
+ void
++bstack(void) {
++	unsigned int i, n, nx, ny, nw, nh, mh, tw, th;
++	Client *c;
++
++	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
++		n++;
++
++	/* window geoms */
++	mh = (n > 1) ? (wah * mwfact) / 1 : wah / (n > 0 ? n : 1);
++	th = (n > 1) ? (wah * (1 - mwfact)) / 1 : 0;
++	tw = (n > 1) ? waw / (n - 1) : 0;
++
++	for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) {
++		c->ismax = False;
++		nx = wax;
++		ny = way;
++		if(i < 1) {
++			ny += i * mh;
++			nw = waw - 2 * c->border;
++			nh = mh - 2 * c->border;
++		}
++		else {
++			nx += (i - 1) * tw;
++			ny += mh * 1;
++			if(i + 1 == n) { /* remainder */
++				nw = (wax + waw) - nx - 2 * c->border;
++			}
++			else {
++				nw = tw - 2 * c->border;
++			}
++			nh = th - 2 * c->border + 1;
++		}
++		resize(c, nx, ny, nw, nh, False);
++		i++;
++	}
++}
++
++void
+ zoom(const char *arg) {
+ 	Client *c;
+ 
+--- /usr/local/src/dwm/dwm-4.4-virgin/tile.h	2007-08-23 19:12:01.000000000 -0400
++++ tile.h	2007-08-24 18:50:30.000000000 -0400
+@@ -3,4 +3,5 @@
+ /* tile.c */
+ void setmwfact(const char *arg);	/* sets master width factor */
+ void tile(void);			/* arranges all windows tiled */
++void bstack(void);			/* arranges all windows bottom stacked */
+ void zoom(const char *arg);		/* zooms the focused client to master area, arg is ignored */
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/extrapatch-fibonacci	2007-09-20 16:23:22.000000000 +0300
@@ -0,0 +1,78 @@
+diff -ruN fibonacci.c fibonacci.c
+--- fibonacci.c	1970-01-01 01:00:00.000000000 +0100
++++ fibonacci.c	2007-08-26 15:09:31.000000000 +0200
+@@ -0,0 +1,67 @@
++/* See LICENSE file for copyright and license details. */
++#include "dwm.h"
++
++/* static */
++
++static void
++fibonacci(int shape) {
++	unsigned int i, n, nx, ny, nw, nh;
++	Client *c;
++
++	nx = wax;
++	ny = 0;
++	nw = waw;
++	nh = wah;
++	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
++		n++;
++	for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) {
++		c->ismax = False;
++		if((i % 2 && nh / 2 > 2 * c->border)
++		|| (!(i % 2) && nw / 2 > 2 * c->border))
++		{
++			if(i < n - 1) {
++				if(i % 2)
++					nh /= 2;
++				else
++					nw /= 2;
++				if((i % 4) == 2 && !shape)
++					nx += nw;
++				else if((i % 4) == 3 && !shape)
++					ny += nh;
++			}
++			if((i % 4) == 0) {
++				if(shape)
++					ny += nh;
++				else
++					ny -= nh;
++			}
++			else if((i % 4) == 1)
++				nx += nw;
++			else if((i % 4) == 2)
++				ny += nh;
++			else if((i % 4) == 3) {
++				if(shape)
++					nx += nw;
++				else
++					nx -= nw;
++			}
++			if(i == 0)
++				ny = way;
++		}
++		resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, False);
++	}
++	focus(NULL);
++	restack();
++}
++
++/* extern */
++
++void
++dwindle(void) {
++	fibonacci(1);
++}
++
++void
++spiral(void) {
++	fibonacci(0);
++}
+diff -ruN fibonacci.h fibonacci.h
+--- fibonacci.h	1970-01-01 01:00:00.000000000 +0100
++++ fibonacci.h	2007-08-26 15:08:33.000000000 +0200
+@@ -0,0 +1,3 @@
++/* fibonacci.c */
++void dwindle(void);			/* arranges all windows in a fibonacci diagonal */
++void spiral(void);			/* arranges all windows in a fibonacci spiral */	
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/extrapatch-gridmode	2007-09-20 14:29:15.000000000 +0300
@@ -0,0 +1,44 @@
+diff -r 795c26a59016 grid.c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ grid.c	Sat Sep 01 20:06:19 2007 +0200
+@@ -0,0 +1,32 @@
++/* See LICENSE file for copyright and license details. */
++#include "dwm.h"
++
++/* extern */
++void
++grid(void) {
++	unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows;
++	Client *c;
++
++	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
++		n++;
++
++	/* grid dimensions */
++	for(rows = 0; rows <= n/2; rows++)
++		if(rows*rows >= n)
++			break;
++	cols = (rows && (rows - 1) * rows >= n) ? rows - 1 : rows;
++
++	/* window geoms (cell height/width) */
++	ch = wah / (rows ? rows : 1);
++	cw = waw / (cols ? cols : 1);
++
++	for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) {
++		c->ismax = False;
++		cx = (i / rows) * cw;
++		cy = (i % rows) * ch + (bpos == BarTop ? bh : 0); /* bh? adjust */
++		/* adjust height/width of last row/column's windows */ 
++		ah = ((i + 1) % rows == 0) ? wah - ch * rows : 0;
++		aw = (i >= rows * (cols - 1)) ? waw - cw * cols : 0;
++		resize(c, cx, cy, cw - 2 * c->border + aw, ch - 2 * c->border + ah, False);
++	}
++}
+diff -r 795c26a59016 grid.h
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ grid.h	Sat Sep 01 20:06:19 2007 +0200
+@@ -0,0 +1,4 @@
++/* See LICENSE file for copyright and license details. */
++
++/* grid.c */
++void grid(void);			/* arranges all windows on a grid */
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/extrapatch-lowerfloat	2007-09-09 22:57:01.000000000 +0300
@@ -0,0 +1,26 @@
+--- screen.c.orig	2007-07-26 18:29:10.000000000 +0300
++++ screen.c	2007-07-26 18:29:51.000000000 +0300
+@@ -229,22 +229,7 @@
+ 	drawstatus();
+ 	if(!sel)
+ 		return;
+-	if(sel->isfloating || isfloating())
+-		XRaiseWindow(dpy, sel->win);
+-	if(!isfloating()) {
+-		wc.stack_mode = Below;
+-		wc.sibling = barwin;
+-		if(!sel->isfloating) {
+-			XConfigureWindow(dpy, sel->win, CWSibling | CWStackMode, &wc);
+-			wc.sibling = sel->win;
+-		}
+-		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
+-			if(c == sel)
+-				continue;
+-			XConfigureWindow(dpy, c->win, CWSibling | CWStackMode, &wc);
+-			wc.sibling = c->win;
+-		}
+-	}
++	XRaiseWindow(dpy, sel->win);
+ 	XSync(dpy, False);
+ 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+ }
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/extrapatch-nmaster	2007-09-20 15:59:54.000000000 +0300
@@ -0,0 +1,94 @@
+diff -r 795c26a59016 tile.c
+--- tile.c	Sun Aug 26 12:54:20 2007 +0200
++++ tile.c	Sun Aug 26 15:06:20 2007 +0200
+@@ -5,8 +5,29 @@
+ /* static */
+ 
+ static double mwfact = MWFACT;
++static unsigned int nmaster = NMASTER;
+ 
+ /* extern */
++
++void
++incnmaster(const char *arg) {
++	int i;
++
++	if(!isarrange(tile))
++		return;
++	if(!arg)
++		nmaster = NMASTER;
++	else {
++		i = atoi(arg);
++		if((nmaster + i) < 1 || wah / (nmaster + i) <= 2 * BORDERPX)
++			return;
++		nmaster += i;
++	}
++	if(sel)
++		arrange();
++	else
++		drawstatus();
++}
+ 
+ void
+ setmwfact(const char *arg) {
+@@ -32,28 +53,33 @@ setmwfact(const char *arg) {
+ 
+ void
+ tile(void) {
+-	unsigned int i, n, nx, ny, nw, nh, mw, th;
++	unsigned int i, n, nx, ny, nw, nh, mw, mh, th;
+ 	Client *c;
+ 
+ 	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
+ 		n++;
+ 
+ 	/* window geoms */
+-	mw = (n == 1) ? waw : mwfact * waw;
+-	th = (n > 1) ? wah / (n - 1) : 0;
+-	if(n > 1 && th < bh)
++	mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster;
++	mw = (n <= nmaster) ? waw : mwfact * waw;
++	th = (n > nmaster) ? wah / (n - nmaster) : 0;
++	if(n > nmaster && th < bh)
+ 		th = wah;
+ 
+ 	nx = wax;
+ 	ny = way;
+ 	for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) {
+ 		c->ismax = False;
+-		if(i == 0) { /* master */
++		if(i < nmaster) { /* master */
++			ny = way + i * mh;
+ 			nw = mw - 2 * c->border;
+-			nh = wah - 2 * c->border;
++			nh = mh;
++			if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */
++				nh = wah - mh * i;
++			nh -= 2 * c->border;
+ 		}
+ 		else {  /* tile window */
+-			if(i == 1) {
++			if(i == nmaster) {
+ 				ny = way;
+ 				nx += mw;
+ 			}
+@@ -64,7 +90,7 @@ tile(void) {
+ 				nh = th - 2 * c->border;
+ 		}
+ 		resize(c, nx, ny, nw, nh, False);
+-		if(n > 1 && th != wah)
++		if(n > nmaster && th != wah)
+ 			ny += nh + 2 * c->border;
+ 	}
+ }
+diff -r 795c26a59016 tile.h
+--- tile.h	Sun Aug 26 12:54:20 2007 +0200
++++ tile.h	Sun Aug 26 15:06:20 2007 +0200
+@@ -1,6 +1,7 @@
+ /* See LICENSE file for copyright and license details. */
+ 
+ /* tile.c */
++void incnmaster(const char *arg);	/* increments nmaster value */
+ void setmwfact(const char *arg);	/* sets master width factor */
+ void tile(void);			/* arranges all windows tiled */
+ void zoom(const char *arg);		/* zooms the focused client to master area, arg is ignored */
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/extrapatch-save_floats	2007-09-09 23:55:53.000000000 +0300
@@ -0,0 +1,66 @@
+diff -r 1c30ac0aee7f client.c
+--- client.c	Thu Aug 23 18:15:13 2007 +0200
++++ client.c	Sat Aug 25 00:49:51 2007 +0200
+@@ -212,6 +212,10 @@ manage(Window w, XWindowAttributes *wa) 
+ 	XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
+ 	configure(c); /* propagates border_width, if size doesn't change */
+ 	updatesizehints(c);
++	c->sfx = c->x;
++	c->sfy = c->y;
++	c->sfw = c->w;
++	c->sfh = c->h;
+ 	XSelectInput(dpy, w,
+ 		StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
+ 	grabbuttons(c, False);
+diff -r 1c30ac0aee7f dwm.h
+--- dwm.h	Thu Aug 23 18:15:13 2007 +0200
++++ dwm.h	Sat Aug 25 00:49:51 2007 +0200
+@@ -46,6 +46,7 @@ struct Client {
+ 	char name[256];
+ 	int x, y, w, h;
+ 	int rx, ry, rw, rh; /* revert geometry */
++ 	int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
+ 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
+ 	int minax, maxax, minay, maxay;
+ 	long flags; 
+@@ -73,6 +74,7 @@ typedef struct {
+ 	} font;
+ } DC; /* draw context */
+ 
++extern Bool modeswitch; 		/* mode has been toggled */
+ extern const char *tags[];			/* all tags */
+ extern char stext[256];				/* status text */
+ extern int screen, sx, sy, sw, sh;		/* screen geometry */
+diff -r 1c30ac0aee7f screen.c
+--- screen.c	Thu Aug 23 18:15:13 2007 +0200
++++ screen.c	Sat Aug 25 00:49:51 2007 +0200
+@@ -48,7 +48,11 @@ floating(void) { /* default floating lay
+ 
+ 	for(c = clients; c; c = c->next)
+ 		if(isvisible(c))
+-			resize(c, c->x, c->y, c->w, c->h, True);
++			if(!c->isfloating)
++				/*restore last known float dimensions*/
++				resize(c, c->sfx, c->sfy, c->sfw, c->sfh, True);
++			else
++				resize(c, c->x, c->y, c->w, c->h, True);
+ }
+ 
+ LAYOUTS
+@@ -288,7 +292,15 @@ togglefloating(const char *arg) {
+ 		return;
+ 	sel->isfloating = !sel->isfloating;
+ 	if(sel->isfloating)
+-		resize(sel, sel->x, sel->y, sel->w, sel->h, True);
++		/*restore last known float dimensions*/
++		resize(sel, sel->sfx, sel->sfy, sel->sfw, sel->sfh, True);
++	if(!sel->isfloating) {
++		/*save last known float dimensions*/
++		sel->sfx = sel->x;
++		sel->sfy = sel->y;
++		sel->sfw = sel->w;
++		sel->sfh = sel->h;
++	}
+ 	arrange();
+ }
+ 
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/extrapatch-snap	2007-09-20 16:00:26.000000000 +0300
@@ -0,0 +1,73 @@
+diff -up dwm-3.6.1/event.c dwm-3.6.1-snap/event.c
+--- event.c	2007-02-21 12:08:54.000000000 +0100
++++ event.c	2007-02-21 20:29:17.000000000 +0100
+@@ -28,12 +28,50 @@ getclient(Window w) {
+ 	return c;
+ }
+ 
++
++ 
++static void
++snaptoborder(Client *c, int x, int y, int w, int h, int *cx, int *cy) {
++	int cw,ch;
++	cw=c->w+2*BORDERPX;
++	ch=c->h+2*BORDERPX;
++	if(y+h+SNAP > *cy && *cy+ch > y-SNAP) {
++		/* West outside */
++		if(abs(*cx - w - x) < SNAP)
++			*cx = w+x;
++		/* East outside */
++		else if(abs(*cx + c->w+2*BORDERPX - x) < SNAP)
++			*cx = x-cw;
++		/* West inside */
++		else if(abs(*cx - x) < SNAP)
++			*cx = x;
++		/* East inside */
++		else if(abs(*cx + c->w+2*BORDERPX - x - w) < SNAP)
++			*cx = x + w - (c->w+2*BORDERPX);
++	}
++	if(x+w+SNAP > *cx && *cx + (c->w+2*BORDERPX) > x-SNAP) {
++		/* North outside */
++		if(abs(*cy - h - y) < SNAP)
++			*cy = h+y;
++		/* South outside */
++		else if(abs(*cy + ch - y) < SNAP)
++			*cy = y-ch;
++		/* North inside */
++		else if(abs(*cy - y) < SNAP)
++			*cy = y;
++		/* South inside */
++		else if(abs(*cy + ch - y - h) < SNAP)
++			*cy = y + h - ch;
++	}
++}
++
+ static void
+ movemouse(Client *c) {
+ 	int x1, y1, ocx, ocy, di, nx, ny;
+ 	unsigned int dui;
+ 	Window dummy;
+ 	XEvent ev;
++	Client *cl;
+ 
+ 	ocx = nx = c->x;
+ 	ocy = ny = c->y;
+@@ -57,14 +95,10 @@ movemouse(Client *c) {
+ 			XSync(dpy, False);
+ 			nx = ocx + (ev.xmotion.x - x1);
+ 			ny = ocy + (ev.xmotion.y - y1);
+-			if(abs(wax + nx) < SNAP)
+-				nx = wax;
+-			else if(abs((wax + waw) - (nx + c->w + 2 * c->border)) < SNAP)
+-				nx = wax + waw - c->w - 2 * c->border;
+-			if(abs(way - ny) < SNAP)
+-				ny = way;
+-			else if(abs((way + wah) - (ny + c->h + 2 * c->border)) < SNAP)
+-				ny = way + wah - c->h - 2 * c->border;
++			for(cl = clients; cl; cl = cl->next)
++				if(isvisible(cl) && (cl->isfloating || isfloating()) && cl != c)
++					snaptoborder(c,cl->x,cl->y,cl->w+2*BORDERPX,cl->h+2*BORDERPX,&nx,&ny);
++			snaptoborder(c,wax,way,waw,wah,&nx,&ny);
+ 			resize(c, nx, ny, c->w, c->h, False);
+ 			break;
+ 		}
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/extrapatch-taglayouts	2007-09-10 16:36:15.000000000 +0300
@@ -0,0 +1,141 @@
+diff -r 6b7bd61a5bd3 dwm.h
+--- dwm.h	Sun Sep 02 02:02:43 2007 +0200
++++ dwm.h	Sun Sep 02 02:04:28 2007 +0200
+@@ -121,6 +121,7 @@ void applyrules(Client *c);		/* applies 
+ void applyrules(Client *c);		/* applies rules to c */
+ void arrange(void);			/* arranges all windows depending on the layout in use */
+ void compileregs(void);			/* initialize regexps of rules defined in config.h */
++void deinitlayouts(void);		/* deinitialize taglayouts etc */
+ void focusnext(const char *arg);	/* focuses next visible client */
+ void focusprev(const char *arg);	/* focuses prev visible client */
+ const char *getsymbol(void);		/* returns symbol of enabled layout */
+diff -r 6b7bd61a5bd3 main.c
+--- main.c	Sun Sep 02 02:02:43 2007 +0200
++++ main.c	Sun Sep 02 02:04:28 2007 +0200
+@@ -59,6 +59,7 @@ cleanup(void) {
+ 	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
+ 	XSync(dpy, False);
+ 	free(seltags);
++	deinitlayouts();
+ }
+ 
+ static unsigned long
+diff -r 6b7bd61a5bd3 screen.c
+--- screen.c	Sun Sep 02 02:02:43 2007 +0200
++++ screen.c	Sun Sep 02 02:04:28 2007 +0200
+@@ -29,8 +29,9 @@ RULES
+ 
+ static unsigned int nrules = 0;
+ static unsigned int nlayouts = 0;
+-static unsigned int ltidx = 0; /* default */
+ static Regs *regs = NULL;
++static unsigned int* ltidxs;
++static unsigned int csel = 0;
+ 
+ static unsigned int
+ idxoftag(const char *tag) {
+@@ -98,7 +99,7 @@ arrange(void) {
+ 			unban(c);
+ 		else
+ 			ban(c);
+-	layouts[ltidx].arrange();
++	layouts[ltidxs[csel]].arrange();
+ 	focus(NULL);
+ 	restack();
+ }
+@@ -131,6 +132,11 @@ compileregs(void) {
+ }
+ 
+ void
++deinitlayouts(void) {
++	free(ltidxs);
++}
++
++void
+ focusnext(const char *arg) {
+ 	Client *c;
+ 
+@@ -165,13 +171,16 @@ const char *
+ const char *
+ getsymbol(void)
+ {
+-	return layouts[ltidx].symbol;
++	return layouts[ltidxs[csel]].symbol;
+ }
+ 
+ void
+ initlayouts(void) {
+ 	unsigned int i, w;
+ 
++	ltidxs = (unsigned int*)emallocz(sizeof(unsigned int) * ntags);
++	for(i = 0; i < ntags; i++)
++		ltidxs[i] = 0;
+ 	nlayouts = sizeof layouts / sizeof layouts[0];
+ 	for(blw = i = 0; i < nlayouts; i++) {
+ 		w = textw(layouts[i].symbol);
+@@ -182,13 +191,13 @@ initlayouts(void) {
+ 
+ Bool
+ isfloating(void) {
+-	return layouts[ltidx].arrange == floating;
++	return layouts[ltidxs[csel]].arrange == floating;
+ }
+ 
+ Bool
+ isarrange(void (*func)())
+ {
+-	return func == layouts[ltidx].arrange;
++	return func == layouts[ltidxs[csel]].arrange;
+ }
+ 
+ Bool
+@@ -241,8 +250,8 @@ setlayout(const char *arg) {
+ 	unsigned int i;
+ 
+ 	if(!arg) {
+-		if(++ltidx == nlayouts)
+-			ltidx = 0;;
++		if(++ltidxs[csel] == nlayouts)
++			ltidxs[csel] = 0;;
+ 	}
+ 	else {
+ 		for(i = 0; i < nlayouts; i++)
+@@ -250,7 +259,7 @@ setlayout(const char *arg) {
+ 				break;
+ 		if(i == nlayouts)
+ 			return;
+-		ltidx = i;
++		ltidxs[csel] = i;
+ 	}
+ 	if(sel)
+ 		arrange();
+@@ -332,8 +341,12 @@ toggleview(const char *arg) {
+ 	i = idxoftag(arg);
+ 	seltags[i] = !seltags[i];
+ 	for(j = 0; j < ntags && !seltags[j]; j++);
+-	if(j == ntags)
++	if(j == ntags) {
+ 		seltags[i] = True; /* cannot toggle last view */
++		j = i;
++	}
++	if(csel == i)
++		csel = j;
+ 	arrange();
+ }
+ 
+@@ -369,8 +382,10 @@ view(const char *arg) {
+ 
+ 	for(i = 0; i < ntags; i++)
+ 		seltags[i] = arg == NULL;
+-	i = idxoftag(arg);
+-	if(i >= 0 && i < ntags)
+-		seltags[i] = True;
+-	arrange();
+-}
++	if (!arg)
++		return;
++	i = idxoftag(arg);
++	seltags[i] = True;
++	csel = i;
++	arrange();
++}
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/extrapatch-warp	2007-09-09 22:51:31.000000000 +0300
@@ -0,0 +1,25 @@
+diff -up dwm-3.6.1/layout.c dwm-3.6.1-warp/screen.c
+--- screen.c	2007-02-21 12:08:54.000000000 +0100
++++ screen.c	2007-02-21 14:31:28.000000000 +0100
+@@ -150,7 +150,20 @@ void
+ restack(void) {
+ 	Client *c;
+ 	XEvent ev;
+	XWindowChanges wc;
++	Window dummy;
++	int wex, wey, ex, ey, i;
++	unsigned int dmask;
+ 
++	if(sel) {
++		XQueryPointer(dpy, sel->win, &dummy, &dummy, &i, &i, &wex, &wey, &dmask);
++		XTranslateCoordinates(dpy, sel->win, root, wex, wey, &ex, &ey, &dummy);
++		/* I'm so sorry for this... Shame on me... */
++		if(ex > wax && ex < wax + waw && ey > way && ey < way + wah) {
++			XSelectInput(dpy, root, SubstructureRedirectMask & EnterWindowMask);
++			XWarpPointer(dpy, None, sel->win, 0, 0, 0, 0, sel->w / 2, sel->h / 2);
++			XSelectInput(dpy, root, SubstructureRedirectMask);
++		}
++	}
+ 	drawstatus();
+ 	if(!sel)
+ 		return;
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/bstack.sed	2007-09-20 16:29:52.000000000 +0300
@@ -0,0 +1,3 @@
+/floating }, \\/a\
+\	{ "[TTT]",		bstack}, \\
+
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/fibonacci.sed	2007-09-20 15:50:57.000000000 +0300
@@ -0,0 +1,7 @@
+/^#include "tile.h"/a\
+#include "fibonacci.h"
+
+/floating }, \\/a\
+\	{ "@",			spiral }, \\\
+\	{ "[\\\\]",		dwindle }, \\
+
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/gridmode.sed	2007-09-20 15:52:59.000000000 +0300
@@ -0,0 +1,6 @@
+/^#include "tile.h"/a\
+#include "grid.h"
+
+/floating }, \\/a\
+\	{ "+++",		grid }, \\
+
--- /dev/null	2007-09-20 16:46:53.000000000 +0300
+++ files/nmaster.sed	2007-09-20 16:16:35.000000000 +0300
@@ -0,0 +1,7 @@
+/^#define SNAP.*$/a\
+#define NMASTER			1	\/* clients in master area *\/
+
+/setmwfact,	"+0\.05" }, \\/a\
+\	{ MODKEY|ShiftMask,		XK_h,		incnmaster,	"-1" }, \\\
+\	{ MODKEY|ShiftMask,		XK_l,		incnmaster,	"1" }, \\
+
--- dwm.new.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list