mfwm

A tiling fork of dylanaraps sowm.
git clone git://depsterr.com/git/mfwm
Log | Files | Refs | README | LICENSE

commit 1adf23af8c65b6505fb45cea073fa0c0b01f86bc
parent 8351d8c0dd14426a6b3d659939979bcc0d47d5b4
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Fri, 11 Oct 2019 22:33:01 +0300

docs: update

Diffstat:
Msowm.c | 70++++++++++++++++++++++++++++++++++------------------------------------
1 file changed, 34 insertions(+), 36 deletions(-)

diff --git a/sowm.c b/sowm.c @@ -97,22 +97,20 @@ void win_add(Window w) { exit(1); if (head == NULL) { - c->next = NULL; c->prev = NULL; - c->win = w; head = c; } else { for (t=head;t->next;t=t->next); - c->next = NULL; c->prev = t; - c->win = w; t->next = c; } - cur = c; + c->next = NULL; + c->win = w; + cur = c; } void ws_go(const Arg arg) { @@ -314,39 +312,39 @@ void win_del(Window w) { client *c; for(c=head;c;c=c->next) { - if (c->win == w) { - if (c->prev == NULL && c->next == NULL) { - free(head); - - head = NULL; - cur = NULL; - - ws_save(curr_desk); - return; - } - - if (c->prev == NULL) { - head = c->next; - c->next->prev = NULL; - cur = c->next; - } - - else if (c->next == NULL) { - c->prev->next = NULL; - cur = c->prev; - } - - else { - c->prev->next = c->next; - c->next->prev = c->prev; - cur = c->prev; - } - - free(c); + if (c->win != w) continue; + + if (c->prev == NULL && c->next == NULL) { + free(head); + + head = NULL; + cur = NULL; + ws_save(curr_desk); - win_update(); return; } + + if (c->prev == NULL) { + head = c->next; + c->next->prev = NULL; + cur = c->next; + } + + else if (c->next == NULL) { + c->prev->next = NULL; + cur = c->prev; + } + + else { + c->prev->next = c->next; + c->next->prev = c->prev; + cur = c->prev; + } + + free(c); + ws_save(curr_desk); + win_update(); + return; } } @@ -415,7 +413,7 @@ void wm_init() { start.subwindow = None; - while(!XNextEvent(dis,&ev)) + while(1 && !XNextEvent(dis,&ev)) if (events[ev.type]) events[ev.type](&ev); }