diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-01-04 19:49:10 +0200 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-01-04 20:05:22 +0200 |
| commit | 4bd473c2e1b8cd7a4425631a65888784c8e6613c (patch) | |
| tree | 8dc4282102ca9ed97913091c31cd83f26731b8a9 /monsterwm.c | |
| parent | 89463d5c0e9b23e1c5c6285183622a0615890005 (diff) | |
bugfix removeclient() would freeze if client was on another desktop
Diffstat (limited to 'monsterwm.c')
| -rw-r--r-- | monsterwm.c | 13 |
1 files changed, 8 insertions, 5 deletions
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; nd<DESKTOPS && !found; nd++) + for (select_desktop(nd), p=head; p && !(found = (p == c || p->next == 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; d<DESKTOPS && !found; ++d) - for (select_desktop(d), c=head; c && !((found = (w == c->win))); c=c->next); + for (select_desktop(d), c=head; c && !(found = (w == c->win)); c=c->next); select_desktop(cd); return c; } |
