summaryrefslogtreecommitdiffhomepage
path: root/patch/attachx.c
diff options
context:
space:
mode:
Diffstat (limited to 'patch/attachx.c')
-rw-r--r--patch/attachx.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/patch/attachx.c b/patch/attachx.c
index 9e06b94..0ce908a 100644
--- a/patch/attachx.c
+++ b/patch/attachx.c
@@ -1,8 +1,27 @@
void
attachx(Client *c)
{
- #if ATTACHABOVE_PATCH
+ #if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBOTTOM_PATCH || SEAMLESS_RESTART_PATCH
Client *at;
+ #endif // ATTACHABOVE_PATCH | ATTACHASIDE_PATCH | ATTACHBOTTOM_PATCH | SEAMLESS_RESTART_PATCH
+
+ #if SEAMLESS_RESTART_PATCH
+ if (c->idx > 0) { /* then the client has a designated position in the client list */
+ for (at = c->mon->clients; at; at = at->next) {
+ if (c->idx < at->idx) {
+ c->next = at;
+ c->mon->clients = c;
+ return;
+ } else if (at->idx <= c->idx && (!at->next || c->idx <= at->next->idx)) {
+ c->next = at->next;
+ at->next = c;
+ return;
+ }
+ }
+ }
+ #endif // SEAMLESS_RESTART_PATCH
+
+ #if ATTACHABOVE_PATCH
if (!(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating)) {
for (at = c->mon->clients; at->next != c->mon->sel; at = at->next);
c->next = at->next;
@@ -10,9 +29,7 @@ attachx(Client *c)
return;
}
#elif ATTACHASIDE_PATCH
- Client *at;
unsigned int n;
-
for (at = c->mon->clients, n = 0; at; at = at->next)
if (!at->isfloating && ISVISIBLEONTAG(at, c->tags))
if (++n >= c->mon->nmaster)
@@ -30,7 +47,6 @@ attachx(Client *c)
return;
}
#elif ATTACHBOTTOM_PATCH
- Client *at;
for (at = c->mon->clients; at && at->next; at = at->next);
if (at) {
at->next = c;