docs: update

This commit is contained in:
Dylan Araps 2019-10-13 14:05:12 +03:00
parent 551496f16b
commit 25b94a205b

35
sowm.c
View File

@ -25,7 +25,7 @@ struct key {
typedef struct client client; typedef struct client client;
struct client{ struct client{
client *next, *prev; client *next;
Window win; Window win;
XWindowAttributes a; XWindowAttributes a;
int f; int f;
@ -177,26 +177,15 @@ void win_del(Window w) {
for WIN { for WIN {
if (c->win != w) continue; 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);
return;
}
if (!c->prev) { } else if (c->next) {
list = c->next; list = c->next;
c->next->prev = 0; free(c);
} 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;
} }
@ -250,16 +239,15 @@ void win_to_ws(const Arg arg) {
void win_next() { void win_next() {
Window cur = win_current(); Window cur = win_current();
client *c; client *c, *n;
if (!list) return;
if (cur == root) cur = list->win; if (cur == root) cur = list->win;
for WIN if (c->win == cur) break; for WIN if (c->win == cur) {
n = c->next ? c->next : list ? list : c;
if ((c = c->next ? c->next : list)) { XSetInputFocus(dis, n->win, RevertToParent, CurrentTime);
XSetInputFocus(dis, c->win, RevertToParent, CurrentTime); XRaiseWindow(dis, n->win);
XRaiseWindow(dis, c->win);
} }
} }
@ -329,12 +317,17 @@ void run(const Arg arg) {
execvp((char*)arg.com[0], (char**)arg.com); execvp((char*)arg.com[0], (char**)arg.com);
} }
int xerror(Display *dis, XErrorEvent *ee) {
return 0;
}
int main(void) { int main(void) {
XEvent ev; XEvent ev;
if (!(dis = XOpenDisplay(0x0))) return 0; if (!(dis = XOpenDisplay(0x0))) return 0;
signal(SIGCHLD, SIG_IGN); signal(SIGCHLD, SIG_IGN);
XSetErrorHandler(xerror);
s = DefaultScreen(dis); s = DefaultScreen(dis);
root = RootWindow(dis, s); root = RootWindow(dis, s);