From 4bd473c2e1b8cd7a4425631a65888784c8e6613c Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Wed, 4 Jan 2012 19:49:10 +0200 Subject: bugfix removeclient() would freeze if client was on another desktop --- monsterwm.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'monsterwm.c') diff --git a/monsterwm.c b/monsterwm.c index e16c46a..7fa8dc9 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -477,17 +477,20 @@ void quit(const Arg *arg) { } void removeclient(client *c) { + client *p = NULL; + int nd = 0, cd = current_desktop; + for (Bool found = False; ndnext == c)); p=p->next); if (c == head) { if (head->next) head = head->next; /* more windows on screen */ else { free(head); head = NULL; } /* head is only window on screen */ current = head; - } else { - client *p; for (p=head; p; p=p->next) if (p->next == c) break; - (current = p)->next = c->next; + } else if (c) { + (current = p)->next = c->next; /* p should be previous of c */ free(c); } + select_desktop(cd); tile(); - if (mode == MONOCLE && current) XMapWindow(dis, current->win); update_current(); } @@ -697,7 +700,7 @@ client* wintoclient(Window w) { client *c = NULL; int d = 0, cd = current_desktop; for (Bool found = False; dwin))); c=c->next); + for (select_desktop(d), c=head; c && !(found = (w == c->win)); c=c->next); select_desktop(cd); return c; } -- cgit v1.3.1