Small bug-fix - cycling through visible windows was broken (in focusstack())...

This is the cumulative patch, but the only differences from the last one
are the few lines in focusstack()

Jeremy
diff -r f6c3491c41f1 config.def.h
--- a/config.def.h      Sun Nov 16 13:22:24 2008 +0000
+++ b/config.def.h      Tue Nov 25 13:32:05 2008 -0500
@@ -21,9 +21,9 @@
 static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */
 
 static Rule rules[] = {
-       /* class      instance    title       tags mask     isfloating */
-       { "Gimp",     NULL,       NULL,       0,            True },
-       { "Firefox",  NULL,       NULL,       1 << 8,       True },
+       /* class      instance    title       tags mask     flags */
+       { "Gimp",     NULL,       NULL,       0,            Floating },
+       { "Firefox",  NULL,       NULL,       1 << 8,       Floating },
 };
 
 /* layout(s) */
diff -r f6c3491c41f1 dwm.c
--- a/dwm.c     Sun Nov 16 13:22:24 2008 +0000
+++ b/dwm.c     Tue Nov 25 13:32:05 2008 -0500
@@ -65,6 +65,7 @@
 enum { WMProtocols, WMDelete, WMState, WMLast };        /* default atoms */
 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
        ClkClientWin, ClkRootWin, ClkLast };             /* clicks */
+enum { Normal, Floating, NoFocus=2 };                   /* Client flags for 
Rules */
 
 typedef union {
        int i;
@@ -89,7 +90,7 @@
        int basew, baseh, incw, inch, maxw, maxh, minw, minh;
        int bw, oldbw;
        unsigned int tags;
-       Bool isfixed, isfloating, isurgent;
+       Bool isfixed, isfloating, isurgent, nofocus;
        Client *next;
        Client *snext;
        Window win;
@@ -127,7 +128,7 @@
        const char *instance;
        const char *title;
        unsigned int tags;
-       Bool isfloating;
+       unsigned int flags;
 } Rule;
 
 /* function declarations */
@@ -258,7 +259,8 @@
                        if((!r->title || strstr(c->name, r->title))
                        && (!r->class || (ch.res_class && strstr(ch.res_class, 
r->class)))
                        && (!r->instance || (ch.res_name && strstr(ch.res_name, 
r->instance)))) {
-                               c->isfloating = r->isfloating;
+                               c->isfloating = (r->flags&Floating)!=0;
+                               c->nofocus = (r->flags&NoFocus)!=0;
                                c->tags |= r->tags & TAGMASK;
                        }
                }
@@ -498,7 +500,8 @@
        Client *c;
 
        for(c = clients; c; c = c->next) {
-               occ |= c->tags;
+               if(c->tags!=TAGMASK)
+                       occ |= c->tags;
                if(c->isurgent)
                        urg |= c->tags;
        }
@@ -508,7 +511,7 @@
                dc.w = TEXTW(tags[i]);
                col = tagset[seltags] & 1 << i ? dc.sel : dc.norm;
                drawtext(tags[i], col, urg & 1 << i);
-               drawsquare(sel && sel->tags & 1 << i, occ & 1 << i, urg & 1 << 
i, col);
+               drawsquare(sel && tagset[seltags] & sel->tags & 1 << i, occ & 1 
<< i, urg & 1 << i, col);
                dc.x += dc.w;
        }
        if(blw > 0) {
@@ -610,6 +613,7 @@
 
 void
 focus(Client *c) {
+       Client *inc=c;
        if(!c || !ISVISIBLE(c))
                for(c = stack; c && !ISVISIBLE(c); c = c->snext);
        if(sel && sel != c) {
@@ -619,6 +623,9 @@
        if(c) {
                detachstack(c);
                attachstack(c);
+       }
+       while( !inc && c && c->nofocus ) c=c->next;
+       if(c) {
                grabbuttons(c, True);
                XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
                XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
@@ -644,17 +651,17 @@
        if(!sel)
                return;
        if (arg->i > 0) {
-               for(c = sel->next; c && !ISVISIBLE(c); c = c->next);
+               for(c = sel->next; c && (!ISVISIBLE(c) || c->nofocus); c = 
c->next);
                if(!c)
-                       for(c = clients; c && !ISVISIBLE(c); c = c->next);
+                       for(c = clients; c && (!ISVISIBLE(c) || c->nofocus); c 
= c->next);
        }
        else {
                for(i = clients; i != sel; i = i->next)
-                       if(ISVISIBLE(i))
+                       if(ISVISIBLE(i) && !i->nofocus)
                                c = i;
                if(!c)
                        for(; i; i = i->next)
-                               if(ISVISIBLE(i))
+                               if(ISVISIBLE(i) && !i->nofocus)
                                        c = i;
        }
        if(c) {

Reply via email to