X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=8ade8d709da4c778d3fc26e16ed2a9cdf733c0d0;hp=a04e2b60727990d9a2d35de06c157cd5610e90b6;hb=0bcbda6733cd666dac6bcae3fbee478df3da77ce;hpb=63f792db45b8422aef1be9127c3b5a53ce2e926d diff --git a/dwm.c b/dwm.c index a04e2b6..8ade8d7 100644 --- 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); } } @@ -1238,7 +1243,7 @@ nextvisible(Client *c) { void pop(Client *c) { detach(c); - attach(c); + attach_as_master(c); focus(c); arrange(c->mon); }