JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix pop()
[dwm.git] / dwm.c
diff --git a/dwm.c b/dwm.c
index f123400..8ade8d7 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -145,6 +145,7 @@ static void applyrules(Client *c);
 static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact);
 static void arrange(Monitor *m);
 static void arrangemon(Monitor *m);
+static void attach_as_master(Client *c);
 static void attach(Client *c);
 static void attachstack(Client *c);
 static void buttonpress(XEvent *e);
@@ -410,13 +411,17 @@ arrangemon(Monitor *m) {
 }
 
 void
+attach_as_master(Client *c) {
+       c->next = c->mon->clients;
+       c->mon->clients = c;
+}
+void
 attach(Client *c) {
        if (c->mon->sel) {
                c->next = c->mon->sel->next;
                c->mon->sel->next = c;
        } else {
-               c->next = c->mon->clients;
-               c->mon->clients = c;
+               attach_as_master(c);
        }
 }
 
@@ -547,6 +552,7 @@ clientmessage(XEvent *e) {
                                      || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
        }
        else if(cme->message_type == netatom[NetActiveWindow]) {
+               return;
                if(!ISVISIBLE(c)) {
                        c->mon->seltags ^= 1;
                        c->mon->tagset[c->mon->seltags] = c->tags;
@@ -1237,7 +1243,7 @@ nextvisible(Client *c) {
 void
 pop(Client *c) {
        detach(c);
-       attach(c);
+       attach_as_master(c);
        focus(c);
        arrange(c->mon);
 }