dwm

[fork] dynamic window manager
Log | Files | Refs | README | LICENSE

commit dd4c47f9260b8ab1af829e0cb490ed54b3b0e668
parent ac95178eee920a8228da720a1d97fa4b1fe760e1
Author: hhvn <dev@hhvn.uk>
Date:   Fri, 15 Apr 2022 20:00:25 +0100

Replace attachaside with attachbelow implementation

Diffstat:
Mdwm.c | 36+++++++++++++-----------------------
1 file changed, 13 insertions(+), 23 deletions(-)

diff --git a/dwm.c b/dwm.c @@ -156,7 +156,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac static void arrange(Monitor *m); static void arrangemon(Monitor *m); static void attach(Client *c); -static void attachaside(Client *c); +static void attachbottom(Client *c); static void attachstack(Client *c); static void checkotherwm(void); static void cleanup(void); @@ -191,7 +191,6 @@ static void manage(Window w, XWindowAttributes *wa); static void mappingnotify(XEvent *e); static void maprequest(XEvent *e); static void motionnotify(XEvent *e); -static Client *nexttagged(Client *c); static Client *nexttiled(Client *c); static void pop(Client *); static void propertynotify(XEvent *e); @@ -427,14 +426,15 @@ attach(Client *c) } void -attachaside(Client *c) { - Client *at = nexttagged(c); - if(!at) { - attach(c); - return; - } - c->next = at->next; - at->next = c; +attachbottom(Client *c) { + Client *p; + c->next = NULL; + if (!c->mon->clients) { + c->mon->clients = c; + } else { + for (p = c->mon->clients; p && p->next; p = p->next); + p->next = c; + } } void @@ -1188,7 +1188,7 @@ manage(Window w, XWindowAttributes *wa) c->isfloating = c->oldstate = t || c->isfixed; if (c->isfloating) XRaiseWindow(dpy, c->win); - attachaside(c); + attachbottom(c); attachstack(c); XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, (unsigned char *) &(c->win), 1); @@ -1275,16 +1275,6 @@ motionnotify(XEvent *e) } Client * -nexttagged(Client *c) { - Client *walked = c->mon->clients; - for(; - walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags)); - walked = walked->next - ); - return walked; -} - -Client * nexttiled(Client *c) { for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next); @@ -1451,7 +1441,7 @@ sendmon(Client *c, Monitor *m) detachstack(c); c->mon = m; c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ - attachaside(c); + attachbottom(c); attachstack(c); focus(NULL); arrange(NULL); @@ -1965,7 +1955,7 @@ updategeom(void) m->clients = c->next; detachstack(c); c->mon = mons; - attachaside(c); + attachbottom(c); attachstack(c); } if (m == selmon)