attachx.c (1520B)
1 void 2 attachx(Client *c) 3 { 4 #if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBOTTOM_PATCH || SEAMLESS_RESTART_PATCH 5 Client *at; 6 #endif // ATTACHABOVE_PATCH | ATTACHASIDE_PATCH | ATTACHBOTTOM_PATCH | SEAMLESS_RESTART_PATCH 7 8 #if SEAMLESS_RESTART_PATCH 9 if (c->idx > 0) { /* then the client has a designated position in the client list */ 10 for (at = c->mon->clients; at; at = at->next) { 11 if (c->idx < at->idx) { 12 c->next = at; 13 c->mon->clients = c; 14 return; 15 } else if (at->idx <= c->idx && (!at->next || c->idx <= at->next->idx)) { 16 c->next = at->next; 17 at->next = c; 18 return; 19 } 20 } 21 } 22 #endif // SEAMLESS_RESTART_PATCH 23 24 #if ATTACHABOVE_PATCH 25 if (!(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating)) { 26 for (at = c->mon->clients; at->next != c->mon->sel; at = at->next); 27 c->next = at->next; 28 at->next = c; 29 return; 30 } 31 #elif ATTACHASIDE_PATCH 32 unsigned int n; 33 for (at = c->mon->clients, n = 0; at; at = at->next) 34 if (!at->isfloating && ISVISIBLEONTAG(at, c->tags)) 35 if (++n >= c->mon->nmaster) 36 break; 37 38 if (at && c->mon->nmaster) { 39 c->next = at->next; 40 at->next = c; 41 return; 42 } 43 #elif ATTACHBELOW_PATCH 44 if (!(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfloating)) { 45 c->next = c->mon->sel->next; 46 c->mon->sel->next = c; 47 return; 48 } 49 #elif ATTACHBOTTOM_PATCH 50 for (at = c->mon->clients; at && at->next; at = at->next); 51 if (at) { 52 at->next = c; 53 c->next = NULL; 54 return; 55 } 56 #endif 57 attach(c); // master (default) 58 } 59