all repos — dwm @ 72707c2fae68f5eba6ea97cbf356bfb968c8a15d

my dwm build

using double-linked list in order to get correct prev focus handling
arg@10ksloc.org unknown
Thu, 20 Jul 2006 16:54:20 +0200
commit

72707c2fae68f5eba6ea97cbf356bfb968c8a15d

parent

06dc514bc7327f1a2a35cb533bcf18715305da44

4 files changed, 45 insertions(+), 21 deletions(-)

jump to
M client.cclient.c

@@ -77,7 +77,6 @@ if(!(c = getnext(sel->next, tsel)))

c = getnext(clients, tsel); if(c) { higher(c); - c->revert = sel; focus(c); } }

@@ -93,7 +92,11 @@

if(sel->ismax) togglemax(NULL); - if((c = sel->revert && sel->revert->tags[tsel] ? sel->revert : NULL)) { + if(!(c = getprev(sel->prev))) { + for(c = clients; c && c->next; c = c->next); + c = getprev(c); + } + if(c) { higher(c); focus(c); }

@@ -127,6 +130,8 @@ {

int dx = 0, dy = 0; switch(c->grav) { + default: + break; case StaticGravity: case NorthWestGravity: case NorthGravity:

@@ -143,11 +148,11 @@ case SouthGravity:

case SouthWestGravity: dy = -(c->h); break; - default: - break; } switch (c->grav) { + default: + break; case StaticGravity: case NorthWestGravity: case WestGravity:

@@ -163,8 +168,6 @@ case NorthEastGravity:

case EastGravity: case SouthEastGravity: dx = -(c->w + c->border); - break; - default: break; }

@@ -204,7 +207,6 @@

void manage(Window w, XWindowAttributes *wa) { - int diff; Client *c; Window trans; XSetWindowAttributes twa;

@@ -224,7 +226,7 @@ c->border = 1;

c->proto = getproto(c->win); setsize(c); XSelectInput(dpy, c->win, - StructureNotifyMask | PropertyChangeMask | EnterWindowMask); + StructureNotifyMask | PropertyChangeMask | EnterWindowMask); XGetTransientForHint(dpy, c->win, &trans); twa.override_redirect = 1; twa.background_pixmap = ParentRelative;

@@ -237,6 +239,8 @@ CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);

settags(c); + if(clients) + clients->prev = c; c->next = clients; clients = c;

@@ -264,6 +268,7 @@ }

else { XMapRaised(dpy, c->win); XMapRaised(dpy, c->title); + } }

@@ -273,9 +278,15 @@ {

Client **l; for(l = &clients; *l && *l != c; l = &(*l)->next); + if(c->prev) + c->prev->next = c->next; + if(c->next) + c->next->prev = c->prev; *l = c->next; - c->next = clients; /* pop */ + if(clients) + clients->prev = c; + c->next = clients; clients = c; arrange(NULL); }

@@ -439,13 +450,18 @@ XUngrabButton(dpy, AnyButton, AnyModifier, c->win);

XDestroyWindow(dpy, c->title); for(l = &clients; *l && *l != c; l = &(*l)->next); + if(c->prev) + c->prev->next = c->next; + if(c->next) + c->next->prev = c->prev; *l = c->next; - for(l = &clients; *l; l = &(*l)->next) - if((*l)->revert == c) - (*l)->revert = NULL; - if(sel == c) - sel = sel->revert ? sel->revert : clients; - + if(sel == c) { + sel = getnext(c->next, tsel); + if(!sel) + sel = getprev(c->prev); + if(!sel) + sel = clients; + } free(c); XSync(dpy, False);
M config.mkconfig.mk

@@ -13,12 +13,12 @@ # includes and libs

LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11 # Linux/BSD -CFLAGS = -O3 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ - -DVERSION=\"${VERSION}\" -LDFLAGS = ${LIBS} -#CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ +#CFLAGS = -O3 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ # -DVERSION=\"${VERSION}\" -#LDFLAGS = -g ${LIBS} +#LDFLAGS = ${LIBS} +CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ + -DVERSION=\"${VERSION}\" +LDFLAGS = -g ${LIBS} # Solaris
M dwm.hdwm.h

@@ -76,7 +76,7 @@ long flags;

Bool isfloat; Bool ismax; Client *next; - Client *revert; + Client *prev; Window win; Window title; };

@@ -135,6 +135,7 @@ extern void appendtag(Arg *arg);

extern void dofloat(Arg *arg); extern void dotile(Arg *arg); extern Client *getnext(Client *c, unsigned int t); +extern Client *getprev(Client *c); extern void heretag(Arg *arg); extern void replacetag(Arg *arg); extern void settags(Client *c);
M tag.ctag.c

@@ -140,6 +140,13 @@ for(; c && !c->tags[t]; c = c->next);

return c; } +Client * +getprev(Client *c) +{ + for(; c && !c->tags[tsel]; c = c->prev); + return c; +} + void heretag(Arg *arg) {