sowm: simpler window add

This commit is contained in:
Dylan Araps 2019-10-18 13:45:02 +03:00
parent f10cec8509
commit 493302d38b
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

19
sowm.c
View File

@ -130,24 +130,21 @@ void button_release() {
}
void win_add(Window w) {
client *c, *t;
client *c, *t = list;
if (!(c = (client *) calloc(1, sizeof(client))))
exit(1);
if (!list) {
c->next = c->prev = 0;
c->w = w;
list = c;
c->w = w;
} else {
for (t=list;t->next;t=t->next);
if (list) {
while (t->next) t = t->next;
c->next = 0;
c->prev = t;
c->w = w;
t->next = c;
}
c->prev = t;
} else
list = c;
ws_save(ws);
}