aewl

changeset 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 d31b5ad96b0b
files client.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/client.c	Fri Jul 14 17:43:56 2006 +0200
     1.2 +++ b/client.c	Fri Jul 14 18:11:36 2006 +0200
     1.3 @@ -28,13 +28,15 @@
     1.4  void
     1.5  zoom(Arg *arg)
     1.6  {
     1.7 -	Client **l;
     1.8 +	Client **l, *c;
     1.9  
    1.10  	if(!sel)
    1.11  		return;
    1.12  
    1.13 -	if(sel == next(clients)) 
    1.14 -		sel = next(sel->next);
    1.15 +	if(sel == next(clients) && sel->next)  {
    1.16 +		if((c = next(sel->next)))
    1.17 +			sel = c;
    1.18 +	}
    1.19  
    1.20  	for(l = &clients; *l && *l != sel; l = &(*l)->next);
    1.21  	*l = sel->next;
    1.22 @@ -497,6 +499,10 @@
    1.23  		if(c->inch)
    1.24  			c->h -= (c->h - c->baseh) % c->inch;
    1.25  	}
    1.26 +	if(c->x > sw) /* might happen on restart */
    1.27 +		c->x = sw - c->w;
    1.28 +	if(c->y > sh)
    1.29 +		c->ty = c->y = sh - c->h;
    1.30  	if(c->minw && c->w < c->minw)
    1.31  		c->w = c->minw;
    1.32  	if(c->minh && c->h < c->minh)