JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fixed focusmon brokeness
[dwm.git] / dwm.c
diff --git a/dwm.c b/dwm.c
index 6459512..096895c 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -804,13 +804,11 @@ focusmon(const Arg *arg) {
 
        for(i = 0, m = mons; m; m = m->next, i++)
                if(i == arg->ui) {
-                       if(m->stack)
-                               focus(m->stack);
-                       else {
-                               unfocus(selmon->stack);
-                               selmon = m;
-                               focus(NULL);
-                       }
+                       if(m == selmon)
+                               return;
+                       unfocus(selmon->sel);
+                       selmon = m;
+                       focus(NULL);
                        drawbars();
                        break;
                }
@@ -1502,12 +1500,10 @@ tagmon(const Arg *arg) {
                        detach(c);
                        detachstack(c);
                        c->mon = m;
-                       c->tags = selmon->seltags; /* assign tags of target monitor */
+                       c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
                        attach(c);
                        attachstack(c);
-                       m->sel = c;
-                       for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
-                       selmon->sel = c;
+                       focus(NULL);
                        arrange();
                        break;
                }