fixed getclient brokeness
891831fe
1 file(s) · +8 −5
| 829 | 829 | ||
| 830 | 830 | Client * |
|
| 831 | 831 | getclient(Window w) { |
|
| 832 | - | Client *c = NULL; |
|
| 832 | + | Client *c; |
|
| 833 | 833 | Monitor *m; |
|
| 834 | 834 | ||
| 835 | 835 | for(m = mons; m; m = m->next) |
|
| 836 | - | for(c = m->clients; c && c->win != w; c = c->next); |
|
| 837 | - | return c; |
|
| 836 | + | for(c = m->clients; c; c = c->next) |
|
| 837 | + | if(c->win == w) |
|
| 838 | + | return c; |
|
| 839 | + | return NULL; |
|
| 838 | 840 | } |
|
| 839 | 841 | ||
| 840 | 842 | unsigned long |
|
| 1726 | 1728 | ||
| 1727 | 1729 | /* reassign left over clients of disappeared monitors */ |
|
| 1728 | 1730 | for(tm = mons; tm; tm = tm->next) { |
|
| 1729 | - | while((c = tm->clients)) { |
|
| 1730 | - | detach(c); |
|
| 1731 | + | while(tm->clients) { |
|
| 1732 | + | c = tm->clients; |
|
| 1733 | + | tm->clients = c->next; |
|
| 1731 | 1734 | detachstack(c); |
|
| 1732 | 1735 | c->mon = newmons; |
|
| 1733 | 1736 | attach(c); |
|