From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Sep 25 11:50:07 2007 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BCEF16A418 for ; Tue, 25 Sep 2007 11:50:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 6EC0A13C4A5 for ; Tue, 25 Sep 2007 11:50:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l8PBo7Ke055785 for ; Tue, 25 Sep 2007 11:50:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l8PBo7NG055783; Tue, 25 Sep 2007 11:50:07 GMT (envelope-from gnats) Date: Tue, 25 Sep 2007 11:50:07 GMT Message-Id: <200709251150.l8PBo7NG055783@freefall.freebsd.org> To: freebsd-ports-bugs@FreeBSD.org From: Nikos Ntarmos Cc: Subject: Re: ports/116495: [patch] Adding a banch of semi-official patches to x11-wm/dwm X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Nikos Ntarmos List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2007 11:50:07 -0000 The following reply was made to PR ports/116495; it has been noted by GNATS. From: Nikos Ntarmos To: bug-followup@freebsd.org Cc: schot@a-eskwadraat.nl Subject: Re: ports/116495: [patch] Adding a banch of semi-official patches to x11-wm/dwm Date: Tue, 25 Sep 2007 14:39:52 +0300 x11-wm/dwm was updated to version 4.5 in the meanwhile, so here's a diff versus the latest dwm version in the ports tree. Note that, due to changes in the upstream code, the patches had to be tweaked to apply cleanly and to produce a working executable with the desired functionality. \n\n --- dwm.4.5.diff begins here --- --- Makefile.orig 2007-09-23 08:57:51.000000000 +0300 +++ Makefile 2007-09-25 14:26:09.000000000 +0300 @@ -7,6 +7,7 @@ PORTNAME= dwm PORTVERSION= 4.5 +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 size 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 + +.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.h + ${REINPLACE_CMD} -e 's/isarrange(tile)/(isarrange(tile) || isarrange(bstack))/' ${WRKSRC}/dwm.c +.endif +.if defined(WITH_FIBON) + ${REINPLACE_CMD} -e 's/^SRC =.*$$/& fibonacci.c/' ${WRKSRC}/config.mk + ${REINPLACE_CMD} -f ${FILESDIR}/fibonacci.sed ${WRKSRC}/config.h + ${REINPLACE_CMD} -e 's/isarrange(tile)/(isarrange(tile) || isarrange(dwindle) || isarrange(spiral))/' ${WRKSRC}/dwm.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.h +.endif +.if defined(WITH_NMSTR) + ${REINPLACE_CMD} -f ${FILESDIR}/nmaster.sed ${WRKSRC}/config.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 +.include --- /dev/null 2007-09-25 14:31:20.000000000 +0300 +++ files/extrapatch-bstack 2007-09-25 14:22:55.000000000 +0300 @@ -0,0 +1,55 @@ +--- /usr/local/src/dwm/dwm-4.4-virgin/dwm.c 2007-08-23 19:12:01.000000000 -0400 ++++ dwm.c 2007-08-24 21:05:05.000000000 -0400 +@@ -174,6 +174,7 @@ + void tile(void); + void togglebar(const char *arg); + void togglefloating(const char *arg); ++void bstack(void); /* arranges all windows bottom stacked */ + void togglemax(const char *arg); + void toggletag(const char *arg); + void toggleview(const char *arg); +@@ -1605,6 +1605,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, RESIZEHINTS); ++ i++; ++ } ++} ++ ++void + togglebar(const char *arg) { + if(bpos == BarOff) + bpos = (BARPOS == BarOff) ? BarTop : BARPOS; --- /dev/null 2007-09-25 14:31:20.000000000 +0300 +++ files/extrapatch-fibonacci 2007-09-25 14:23:04.000000000 +0300 @@ -0,0 +1,83 @@ +--- dwm.c 1970-01-01 01:00:00.000000000 +0100 ++++ dwm.c 2007-08-26 15:08:33.000000000 +0200 +@@ -188,6 +188,8 @@ + void updatetitle(Client *c); + void view(const char *arg); + int xerror(Display *dpy, XErrorEvent *ee); ++void dwindle(void); /* arranges all windows in a fibonacci diagonal */ ++void spiral(void); /* arranges all windows in a fibonacci spiral */ + int xerrordummy(Display *dsply, XErrorEvent *ee); + int xerrorstart(Display *dsply, XErrorEvent *ee); + void zoom(const char *arg); +@@ -1647,6 +1647,71 @@ + return textnw(text, strlen(text)) + dc.font.height; + } + ++/* 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, RESIZEHINTS); ++ } ++ focus(NULL); ++ restack(); ++} ++ ++/* extern */ ++ ++void ++dwindle(void) { ++ fibonacci(1); ++} ++ ++void ++spiral(void) { ++ fibonacci(0); ++} ++ + void + tile(void) { + unsigned int i, n, nx, ny, nw, nh, mw, mh, th; --- /dev/null 2007-09-25 14:31:20.000000000 +0300 +++ files/extrapatch-gridmode 2007-09-25 14:23:10.000000000 +0300 @@ -0,0 +1,46 @@ +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ dwm.c Sat Sep 01 20:06:19 2007 +0200 +@@ -142,6 +142,7 @@ + long getstate(Window w); + Bool gettextprop(Window w, Atom atom, char *text, unsigned int size); + void grabbuttons(Client *c, Bool focused); ++void grid(void); /* arranges all windows on a grid */ + unsigned int idxoftag(const char *tag); + void initfont(const char *fontstr); + Bool isarrange(void (*func)()); +@@ -775,6 +775,35 @@ getstate(Window w) { + return result; + } + ++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, RESIZEHINTS); ++ } ++} ++ + Bool + gettextprop(Window w, Atom atom, char *text, unsigned int size) { + char **list = NULL; --- /dev/null 2007-09-25 14:31:20.000000000 +0300 +++ files/extrapatch-lowerfloat 2007-09-25 12:03:26.000000000 +0300 @@ -0,0 +1,26 @@ +--- dwm.c.orig 2007-07-26 18:29:10.000000000 +0300 ++++ dwm.c 2007-07-26 18:29:51.000000000 +0300 +@@ -1270,22 +1270,7 @@ + drawbar(); + if(!sel) + return; +- if(sel->isfloating || isarrange(floating)) +- XRaiseWindow(dpy, sel->win); +- if(!isarrange(floating)) { +- 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-25 14:31:20.000000000 +0300 +++ files/extrapatch-nmaster 2007-09-25 13:52:49.000000000 +0300 @@ -0,0 +1,90 @@ +diff -r 795c26a59016 tile.c +--- dwm.c Sun Aug 26 12:54:20 2007 +0200 ++++ dwm.c Sun Aug 26 15:06:20 2007 +0200 +@@ -166,6 +166,7 @@ + void scan(void); + void setclientstate(Client *c, long state); + void setlayout(const char *arg); ++void incnmaster(const char *arg); + void setmwfact(const char *arg); + void setup(void); + void spawn(const char *arg); +@@ -1380,6 +1380,28 @@ + drawbar(); + } + ++static unsigned int nmaster = NMASTER; ++ ++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 ++ drawbar(); ++} ++ + void + setmwfact(const char *arg) { + double delta; +@@ -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, RESIZEHINTS); +- if(n > 1 && th != wah) ++ if(n > nmaster && th != wah) + ny += nh + 2 * c->border; + } + } --- /dev/null 2007-09-25 14:31:20.000000000 +0300 +++ files/extrapatch-save_floats 2007-09-25 14:29:43.000000000 +0300 @@ -0,0 +1,60 @@ +diff -r 1c30ac0aee7f client.c +--- dwm.c Thu Aug 23 18:15:13 2007 +0200 ++++ dwm.c Sat Aug 25 00:49:51 2007 +0200 +@@ -61,6 +61,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; +@@ -195,6 +195,7 @@ typedef struct { + char stext[256]; + double mwfact; + int screen, sx, sy, sw, sh, wax, way, waw, wah; ++extern Bool modeswitch; /* mode has been toggled */ + int (*xerrorxlib)(Display *, XErrorEvent *); + unsigned int bh, bpos, ntags; + unsigned int blw = 0; +@@ -681,7 +681,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); + } + + void +@@ -1036,6 +1036,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); +@@ -1634,7 +1634,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-25 14:31:21.000000000 +0300 +++ files/extrapatch-snap 2007-09-25 13:53:24.000000000 +0300 @@ -0,0 +1,72 @@ +--- dwm.c 2007-02-21 12:08:54.000000000 +0100 ++++ dwm.c 2007-02-21 20:29:17.000000000 +0100 +@@ -1088,12 +1088,50 @@ getclient(Window w) { + manage(ev->window, &wa); + } + ++ ++ ++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; ++ } ++} ++ + 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; +@@ -1117,14 +1117,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 || isarrange(floating)) && 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-25 14:31:21.000000000 +0300 +++ files/extrapatch-taglayouts 2007-09-25 13:07:52.000000000 +0300 @@ -0,0 +1,125 @@ +--- dwm.c.orig 2007-09-25 13:03:24.000000000 +0300 ++++ dwm.c 2007-09-25 13:07:37.000000000 +0300 +@@ -123,6 +123,7 @@ + void configure(Client *c); + void configurenotify(XEvent *e); + void configurerequest(XEvent *e); ++void deinitlayouts(void); + void destroynotify(XEvent *e); + void detach(Client *c); + void detachstack(Client *c); +@@ -196,7 +197,8 @@ + int (*xerrorxlib)(Display *, XErrorEvent *); + unsigned int bh, bpos, ntags; + unsigned int blw = 0; +-unsigned int ltidx = 0; /* default */ ++unsigned int* ltidxs; ++unsigned int csel = 0; + unsigned int nlayouts = 0; + unsigned int nrules = 0; + unsigned int numlockmask = 0; +@@ -273,7 +275,7 @@ + unban(c); + else + ban(c); +- layouts[ltidx].arrange(); ++ layouts[ltidxs[csel]].arrange(); + focus(NULL); + restack(); + } +@@ -393,6 +395,7 @@ + XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); + XSync(dpy, False); + free(seltags); ++ deinitlayouts(); + } + + void +@@ -423,6 +426,11 @@ + } + + void ++deinitlayouts(void) { ++ free(ltidxs); ++} ++ ++void + configure(Client *c) { + XConfigureEvent ce; + +@@ -546,7 +554,7 @@ + dc.x += dc.w; + } + dc.w = blw; +- drawtext(layouts[ltidx].symbol, dc.norm); ++ drawtext(layouts[ltidxs[csel]].symbol, dc.norm); + x = dc.x + dc.w; + dc.w = textw(stext); + dc.x = sw - dc.w; +@@ -894,7 +902,7 @@ + Bool + isarrange(void (*func)()) + { +- return func == layouts[ltidx].arrange; ++ return func == layouts[ltidxs[csel]].arrange; + } + + Bool +@@ -1377,8 +1385,8 @@ + unsigned int i; + + if(!arg) { +- if(++ltidx == nlayouts) +- ltidx = 0;; ++ if(++ltidxs[csel] == nlayouts) ++ ltidxs[csel] = 0; + } + else { + for(i = 0; i < nlayouts; i++) +@@ -1386,7 +1394,7 @@ + break; + if(i == nlayouts) + return; +- ltidx = i; ++ ltidxs[csel] = i; + } + if(sel) + arrange(); +@@ -1482,6 +1490,9 @@ + + /* init layouts */ + mwfact = MWFACT; ++ 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++) { + j = textw(layouts[i].symbol); +@@ -1543,9 +1554,11 @@ + return; + for(i = 0; i < ntags; i++) + sel->tags[i] = arg == NULL; ++ if (!arg) ++ return; + i = idxoftag(arg); +- if(i >= 0 && i < ntags) +- sel->tags[i] = True; ++ seltags[i] = True; ++ csel = i; + arrange(); + } + +@@ -1673,8 +1686,12 @@ + i = idxoftag(arg); + seltags[i] = !seltags[i]; + for(j = 0; j < ntags && !seltags[j]; j++); +- if(j == ntags) ++ if(j == ntags) { + seltags[i] = True; /* at least one tag must be viewed */ ++ j = i; ++ } ++ if (csel == i) ++ csel = j; + arrange(); + } + --- /dev/null 2007-09-25 14:31:21.000000000 +0300 +++ files/extrapatch-warp 2007-09-25 13:08:47.000000000 +0300 @@ -0,0 +1,24 @@ +--- dwm.c 2007-02-21 12:08:54.000000000 +0100 ++++ dwm.c 2007-02-21 14:31:28.000000000 +0100 +@@ -1318,7 +1318,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); ++ } ++ } + drawbar(); + if(!sel) + return; --- /dev/null 2007-09-25 14:31:21.000000000 +0300 +++ files/bstack.sed 2007-09-25 14:01:51.000000000 +0300 @@ -0,0 +1,3 @@ +/floating },$/a\ +\ { "[TTT]", bstack}, + --- /dev/null 2007-09-25 14:31:21.000000000 +0300 +++ files/fibonacci.sed 2007-09-25 14:02:00.000000000 +0300 @@ -0,0 +1,4 @@ +/floating },$/a\ +\ { "@", spiral },\ +\ { "[\\\\]", dwindle }, + --- /dev/null 2007-09-25 14:31:21.000000000 +0300 +++ files/gridmode.sed 2007-09-25 14:02:07.000000000 +0300 @@ -0,0 +1,3 @@ +/floating },$/a\ +\ { "+++", grid }, + --- /dev/null 2007-09-25 14:31:21.000000000 +0300 +++ files/nmaster.sed 2007-09-25 14:07:51.000000000 +0300 @@ -0,0 +1,7 @@ +/^#define RESIZEHINTS.*$/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.4.5.diff ends here ---