Mercurial > dwm-meillo
comparison client.c @ 67:a0272d97ec7c
fixed crash on zoom if only 1 client exists
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Fri, 14 Jul 2006 18:11:36 +0200 |
parents | 50450aa24a46 |
children | 7681ef838201 |
comparison
equal
deleted
inserted
replaced
66:50450aa24a46 | 67:a0272d97ec7c |
---|---|
26 } | 26 } |
27 | 27 |
28 void | 28 void |
29 zoom(Arg *arg) | 29 zoom(Arg *arg) |
30 { | 30 { |
31 Client **l; | 31 Client **l, *c; |
32 | 32 |
33 if(!sel) | 33 if(!sel) |
34 return; | 34 return; |
35 | 35 |
36 if(sel == next(clients)) | 36 if(sel == next(clients) && sel->next) { |
37 sel = next(sel->next); | 37 if((c = next(sel->next))) |
38 sel = c; | |
39 } | |
38 | 40 |
39 for(l = &clients; *l && *l != sel; l = &(*l)->next); | 41 for(l = &clients; *l && *l != sel; l = &(*l)->next); |
40 *l = sel->next; | 42 *l = sel->next; |
41 | 43 |
42 sel->next = clients; /* pop */ | 44 sel->next = clients; /* pop */ |
495 if(c->incw) | 497 if(c->incw) |
496 c->w -= (c->w - c->basew) % c->incw; | 498 c->w -= (c->w - c->basew) % c->incw; |
497 if(c->inch) | 499 if(c->inch) |
498 c->h -= (c->h - c->baseh) % c->inch; | 500 c->h -= (c->h - c->baseh) % c->inch; |
499 } | 501 } |
502 if(c->x > sw) /* might happen on restart */ | |
503 c->x = sw - c->w; | |
504 if(c->y > sh) | |
505 c->ty = c->y = sh - c->h; | |
500 if(c->minw && c->w < c->minw) | 506 if(c->minw && c->w < c->minw) |
501 c->w = c->minw; | 507 c->w = c->minw; |
502 if(c->minh && c->h < c->minh) | 508 if(c->minh && c->h < c->minh) |
503 c->h = c->minh; | 509 c->h = c->minh; |
504 if(c->maxw && c->w > c->maxw) | 510 if(c->maxw && c->w > c->maxw) |