X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/5cc27f1b3c61df4f048cdac9e0feb31a2dd80c63..b3d7e07f18f0f69f8c3b3542615da62dfc4c6175:/view.c diff --git a/view.c b/view.c index 72aa04e..4781b4e 100644 --- a/view.c +++ b/view.c @@ -8,14 +8,17 @@ void (*arrange)(void) = DEFMODE; void -detach(Client *c) { - if(c->prev) - c->prev->next = c->next; - if(c->next) - c->next->prev = c->prev; - if(c == clients) - clients = c->next; - c->next = c->prev = NULL; +attach(Client *c) { + if(clients) + clients->prev = c; + c->next = clients; + clients = c; +} + +void +attachstack(Client *c) { + c->snext = stack; + stack = c; } void @@ -41,6 +44,24 @@ dofloat(void) { restack(); } +void +detach(Client *c) { + if(c->prev) + c->prev->next = c->next; + if(c->next) + c->next->prev = c->prev; + if(c == clients) + clients = c->next; + c->next = c->prev = NULL; +} + +void +detachstack(Client *c) { + Client **tc; + for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); + *tc = c->snext; +} + void focusnext(Arg *arg) { Client *c; @@ -73,6 +94,16 @@ focusprev(Arg *arg) { } } +Client * +getclient(Window w) { + Client *c; + + for(c = clients; c; c = c->next) + if(c->win == w) + return c; + return NULL; +} + Bool isvisible(Client *c) { unsigned int i;