aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/dwm/client.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-06-06 19:28:06 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-06-06 19:28:06 -0700
commit186fe25ab798fe559be242dbe2eaff8e553c4e06 (patch)
tree44c3bbf82b188cf160b093082cc6f5b89724cebb /sys/cmd/dwm/client.c
parent20b38eb32bd4118b283f791db35d06c559008118 (diff)
checkin: before adding swallow
Diffstat (limited to 'sys/cmd/dwm/client.c')
-rw-r--r--sys/cmd/dwm/client.c66
1 files changed, 50 insertions, 16 deletions
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;
}
@@ -110,6 +111,20 @@ attach(Client *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)
{
c->snext = c->mon->stack;
@@ -117,20 +132,33 @@ attachstack(Client *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;
}