some focus fixes
authorAnselm R Garbe <garbeam@gmail.com>
Wed, 24 Jun 2009 14:37:32 +0000 (15:37 +0100)
committerAnselm R Garbe <garbeam@gmail.com>
Wed, 24 Jun 2009 14:37:32 +0000 (15:37 +0100)
dwm.c

diff --git a/dwm.c b/dwm.c
index 8862f59..e288ab6 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -762,6 +762,8 @@ focus(Client *c) {
                XSetWindowBorder(dpy, selmon->sel->win, dc.norm[ColBorder]);
        }
        if(c) {
+               if(c->mon != selmon)
+                       selmon = c->mon;
                if(c->isurgent)
                        clearurgent(c);
                detachstack(c);
@@ -792,8 +794,12 @@ focusmon(const Arg *arg) {
 
        for(i = 0, m = mons; m; m = m->next, i++)
                if(i == arg->ui) {
-                       selmon = m;
-                       focus(NULL);
+                       if(m->stack)
+                               focus(m->stack);
+                       else {
+                               selmon = m;
+                               focus(NULL);
+                       }
                        drawbars();
                        break;
                }