aewl

diff view.c @ 480:680aca428830

small change to achieve Jukka's last proposal
author arg@mmvi
date Fri, 22 Sep 2006 13:53:28 +0200
parents de69a7b0c8fa
children 382e3cb5d9a5
line diff
     1.1 --- a/view.c	Fri Sep 22 11:49:24 2006 +0200
     1.2 +++ b/view.c	Fri Sep 22 13:53:28 2006 +0200
     1.3 @@ -18,6 +18,12 @@
     1.4  	return min;
     1.5  }
     1.6  
     1.7 +static Client *
     1.8 +nexttiled(Client *c) {
     1.9 +	for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
    1.10 +	return c;
    1.11 +}
    1.12 +
    1.13  static void
    1.14  reorder() {
    1.15  	Client *c, *newclients, *tail;
    1.16 @@ -36,10 +42,23 @@
    1.17  	clients = newclients;
    1.18  }
    1.19  
    1.20 -static Client *
    1.21 -nexttiled(Client *c) {
    1.22 -	for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
    1.23 -	return c;
    1.24 +static void
    1.25 +togglemax(Client *c)
    1.26 +{
    1.27 +	if((c->ismax = !c->ismax)) {
    1.28 +		c->rx = c->x; c->x = sx;
    1.29 +		c->ry = c->y; c->y = bh;
    1.30 +		c->rw = c->w; c->w = sw;
    1.31 +		c->rh = c->h; c->h = sh;
    1.32 +	}
    1.33 +	else {
    1.34 +		c->x = c->rx;
    1.35 +		c->y = c->ry;
    1.36 +		c->w = c->w;
    1.37 +		c->h = c->h;
    1.38 +	}
    1.39 +	resize(c, True, TopLeft);
    1.40 +	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
    1.41  }
    1.42  
    1.43  /* extern */
    1.44 @@ -82,8 +101,14 @@
    1.45  
    1.46  	w = sw - mw;
    1.47  	for(n = 0, c = clients; c; c = c->next)
    1.48 -		if(isvisible(c) && !c->isfloat)
    1.49 -			n++;
    1.50 +		if(isvisible(c)) {
    1.51 +			if(c->isfloat) {
    1.52 +				if(c->ismax)
    1.53 +					togglemax(c);
    1.54 +			}
    1.55 +			else
    1.56 +				n++;
    1.57 +		}
    1.58  
    1.59  	if(n > 1)
    1.60  		h = (sh - bh) / (n - 1);
    1.61 @@ -269,7 +294,6 @@
    1.62  
    1.63  void
    1.64  zoom(Arg *arg) {
    1.65 -	int tmp;
    1.66  	unsigned int n;
    1.67  	Client *c;
    1.68  	XEvent ev;
    1.69 @@ -278,12 +302,7 @@
    1.70  		return;
    1.71  
    1.72  	if(sel->isfloat || (arrange == dofloat)) {
    1.73 -		sel->x = sx;
    1.74 -		sel->y = bh;
    1.75 -		sel->w = sw;
    1.76 -		sel->h = sh - bh;
    1.77 -		resize(sel, True, TopLeft);
    1.78 -		while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
    1.79 +		togglemax(sel);
    1.80  		return;
    1.81  	}
    1.82