docs: update

This commit is contained in:
Dylan Araps
2019-10-13 15:34:20 +03:00
parent 25b94a205b
commit 2385f2c4e7

49
sowm.c
View File

@@ -25,7 +25,7 @@ struct key {
typedef struct client client; typedef struct client client;
struct client{ struct client{
client *next; client *next, *prev;
Window win; Window win;
XWindowAttributes a; XWindowAttributes a;
int f; int f;
@@ -158,12 +158,16 @@ void win_add(Window w) {
exit(1); exit(1);
if (!list) { if (!list) {
c->next = 0;
c->prev = 0;
c->win = w; c->win = w;
list = c; list = c;
} else { } else {
for (t=list;t->next;t=t->next); for (t=list;t->next;t=t->next);
c->next = 0;
c->prev = t;
c->win = w; c->win = w;
t->next = c; t->next = c;
} }
@@ -174,18 +178,27 @@ void win_add(Window w) {
void win_del(Window w) { void win_del(Window w) {
client *c; client *c;
for WIN { for WIN if (c->win == w) {
if (c->win != w) continue; if (!c->prev && !c->next) {
if (!c->next && c == list) {
free(list); free(list);
list = 0; list = 0;
ws_save(desk);
} else if (c->next) { return;
list = c->next;
free(c);
} }
if (!c->prev) {
list = c->next;
c->next->prev = 0;
} else if (!c->next) {
c->prev->next = 0;
} else {
c->prev->next = c->next;
c->next->prev = c->prev;
}
free(c);
ws_save(desk); ws_save(desk);
return; return;
} }
@@ -232,22 +245,26 @@ void win_to_ws(const Arg arg) {
ws_save(arg.i); ws_save(arg.i);
ws_sel(tmp); ws_sel(tmp);
XUnmapWindow(dis, cur);
win_del(cur); win_del(cur);
XUnmapWindow(dis, cur);
ws_save(tmp); ws_save(tmp);
} }
void win_next() { void win_next() {
Window cur = win_current(); Window cur = win_current();
client *c, *n; client *c;
if (cur == root) cur = list->win; if (list) {
if (cur == root) cur = list->win;
for WIN if (c->win == cur) { for WIN if (c->win == cur) break;
n = c->next ? c->next : list ? list : c;
XSetInputFocus(dis, n->win, RevertToParent, CurrentTime); c = c->next;
XRaiseWindow(dis, n->win);
if (!c) c = list;
XSetInputFocus(dis, c->win, RevertToParent, CurrentTime);
XRaiseWindow(dis, c->win);
} }
} }