From 186fe25ab798fe559be242dbe2eaff8e553c4e06 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sat, 6 Jun 2020 19:28:06 -0700 Subject: checkin: before adding swallow --- sys/cmd/dwm/client.c | 66 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 16 deletions(-) (limited to 'sys/cmd/dwm/client.c') diff --git a/sys/cmd/dwm/client.c b/sys/cmd/dwm/client.c index e9133bf..d2ea972 100644 --- a/sys/cmd/dwm/client.c +++ b/sys/cmd/dwm/client.c @@ -24,7 +24,8 @@ applyrules(Client *c) { c->isfloating = r->isfloating; c->tags |= r->tags; - for (m = mons; m && m->num != r->monitor; m = m->next); + for (m = mons; m && m->num != r->monitor; m = m->next) + ; if (m) c->mon = m; } @@ -109,6 +110,20 @@ attach(Client *c) c->mon->clients = c; } +void +enqueue(Client *c) +{ + Client *l; + + for (l = c->mon->clients; l && l->next; l = l->next) + ; + + if (l) { + l->next = c; + c->next = nil; + } +} + void attachstack(Client *c) { @@ -116,21 +131,34 @@ attachstack(Client *c) c->mon->stack = c; } +void +enqueuestack(Client *c) +{ + Client *l; + for (l = c->mon->clients; l && l->next; l = l->next) + ; + + if (l) { + l->snext = c; + c->snext = nil; + } +} + void configure(Client *c) { XConfigureEvent ce; - ce.type = ConfigureNotify; - ce.display = dpy; - ce.event = c->win; - ce.window = c->win; - ce.x = c->x; - ce.y = c->y; - ce.width = c->w; - ce.height = c->h; - ce.border_width = c->bw; - ce.above = None; + ce.type = ConfigureNotify; + ce.display = dpy; + ce.event = c->win; + ce.window = c->win; + ce.x = c->x; + ce.y = c->y; + ce.width = c->w; + ce.height = c->h; + ce.border_width = c->bw; + ce.above = None; ce.override_redirect = False; XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce); } @@ -140,7 +168,8 @@ detach(Client *c) { Client **tc; - for (tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next); + for (tc = &c->mon->clients; *tc && *tc != c; tc = &(*tc)->next) + ; *tc = c->next; } @@ -149,11 +178,14 @@ detachstack(Client *c) { Client **tc, *t; - for (tc = &c->mon->stack; *tc && *tc != c; tc = &(*tc)->snext); + for (tc = &c->mon->stack; *tc && *tc != c; tc = &(*tc)->snext) + ; + *tc = c->snext; if (c == c->mon->sel) { - for (t = c->mon->stack; t && !ISVISIBLE(t); t = t->snext); + for (t = c->mon->stack; t && !ISVISIBLE(t); t = t->snext) + ; c->mon->sel = t; } } @@ -162,7 +194,8 @@ void focus(Client *c) { if (!c || !ISVISIBLE(c)) - for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); + for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext) + ; if (selmon->sel && selmon->sel != c) unfocus(selmon->sel, 0); if (c) { @@ -223,7 +256,8 @@ grabbuttons(Client *c, int focused) Client * nexttiled(Client *c) { - for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next); + for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next) + ; return c; } -- cgit v1.2.1