> arg wrote:
>
> This seems dangerous if tc is NULL after the loop. There is a
> missing if(tc) { ... }
(..)
> Those operations are not necessary, because c is allocated using
> util.c:emallocz().
Thanks for the fix!
I've tested the new version and works pretty nice now.
Testers and comments are welcome:
http://news.nopcode.org/dwm-append-windows.diff
Regards.
--pancake
diff -ru dwm-3.1.orig/client.c dwm-3.1/client.c
--- dwm-3.1.orig/client.c 2007-01-16 11:41:35.000000000 +0100
+++ dwm-3.1/client.c 2007-01-17 14:40:45.000000000 +0100
@@ -157,11 +157,27 @@
settags(c, getclient(trans));
if(!c->isfloat)
c->isfloat = trans || c->isfixed;
- if(clients)
- clients->prev = c;
- c->next = clients;
+
+ if(apwl) {
+ Client *tc;
+
+ for(tc = clients; tc && tc->next; tc = tc->next);
+ if(tc) {
+ tc->next = c;
+ c->prev = tc;
+ }
+ else
+ clients = c;
+ }
+ else {
+ if(clients)
+ clients->prev = c;
+ c->next = clients;
+ clients = c;
+ }
c->snext = stack;
- stack = clients = c;
+ stack = c;
+
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
XMapWindow(dpy, c->win);
if(isvisible(c))
diff -ru dwm-3.1.orig/config.default.h dwm-3.1/config.default.h
--- dwm-3.1.orig/config.default.h 2007-01-16 11:41:35.000000000 +0100
+++ dwm-3.1/config.default.h 2007-01-17 00:57:54.000000000 +0100
@@ -29,6 +29,8 @@
{ MODKEY, XK_Tab, focusnext, { 0 } }, \
{ MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
{ MODKEY, XK_Return, zoom, { 0 } }, \
+ { MODKEY, XK_a, append, { .i = 0 } }, \
+ { MODKEY, XK_e, append, { .i = 1 } }, \
{ MODKEY, XK_g, resizemaster, { .i = 15 } }, \
{ MODKEY, XK_s, resizemaster, { .i = -15 } }, \
{ MODKEY, XK_i, incnmaster, { .i = 1 } }, \
diff -ru dwm-3.1.orig/dwm.h dwm-3.1/dwm.h
--- dwm-3.1.orig/dwm.h 2007-01-16 11:41:35.000000000 +0100
+++ dwm-3.1/dwm.h 2007-01-17 00:47:52.000000000 +0100
@@ -92,6 +92,7 @@
extern char stext[256]; /* status text */
extern int bh, bmw; /* bar height, bar mode label width */
extern int screen, sx, sy, sw, sh; /* screen geometry */
+extern int apwl; /* append window list boolean */
extern int wax, way, wah, waw; /* windowarea geometry */
extern unsigned int master, nmaster; /* master percent, number of master clients */
extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */
@@ -160,3 +161,4 @@
extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */
extern void view(Arg *arg); /* views the tag with arg's index */
extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */
+extern void append(Arg *arg); /* append new windows to the client's list or not */
Sólo en dwm-3.1: event.o
diff -ru dwm-3.1.orig/main.c dwm-3.1/main.c
--- dwm-3.1.orig/main.c 2007-01-16 11:41:35.000000000 +0100
+++ dwm-3.1/main.c 2007-01-17 00:49:23.000000000 +0100
@@ -19,7 +19,7 @@
char stext[256];
Bool *seltag;
-int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah;
+int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah, apwl;
unsigned int master, nmaster, ntags, numlockmask;
Atom wmatom[WMLast], netatom[NetLast];
Bool running = True;
@@ -248,6 +248,7 @@
screen = DefaultScreen(dpy);
root = RootWindow(dpy, screen);
otherwm = False;
+ apwl = False;
XSetErrorHandler(xerrorstart);
/* this causes an error if some other window manager is running */
XSelectInput(dpy, root, SubstructureRedirectMask);
diff -ru dwm-3.1.orig/view.c dwm-3.1/view.c
--- dwm-3.1.orig/view.c 2007-01-16 11:41:35.000000000 +0100
+++ dwm-3.1/view.c 2007-01-17 00:48:31.000000000 +0100
@@ -267,3 +267,8 @@
focus(c);
arrange();
}
+
+void
+append(Arg *arg) {
+ apwl = arg->i;
+}