dwm-meillo

diff view.c @ 524:1a9a0877650c

keep master ratio on resizecol -> arrange
author Anselm R. Garbe <arg@10kloc.org>
date Thu, 05 Oct 2006 12:59:35 +0200
parents c1dd19da63ef
children c71952fa3c7c
line diff
     1.1 --- a/view.c	Thu Oct 05 12:18:04 2006 +0200
     1.2 +++ b/view.c	Thu Oct 05 12:59:35 2006 +0200
     1.3 @@ -4,8 +4,6 @@
     1.4   */
     1.5  #include "dwm.h"
     1.6  
     1.7 -#define MINDIM			100
     1.8 -
     1.9  /* static */
    1.10  
    1.11  static Client *
    1.12 @@ -106,6 +104,7 @@
    1.13  void
    1.14  dotile(Arg *arg) {
    1.15  	int i, n, stackw, stackh, tw, th;
    1.16 +	unsigned int md = ((stackpos == StackBottom ? sh - bh : sw) * master) / 100;
    1.17  	Client *c;
    1.18  
    1.19  	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
    1.20 @@ -113,10 +112,10 @@
    1.21  
    1.22  	if(stackpos == StackBottom) {
    1.23  		stackw = sw;
    1.24 -		stackh = sh - bh - master;
    1.25 +		stackh = sh - bh - md;
    1.26  	}
    1.27  	else {
    1.28 -		stackw = sw - master;
    1.29 +		stackw = sw - md;
    1.30  		stackh = sh - bh;
    1.31  	}
    1.32  
    1.33 @@ -145,18 +144,18 @@
    1.34  				switch(stackpos) {
    1.35  				case StackLeft:
    1.36  				case StackRight:
    1.37 -					c->w = master - 2 * BORDERPX;
    1.38 +					c->w = md - 2 * BORDERPX;
    1.39  					c->h = sh - bh - 2 * BORDERPX;
    1.40  					break;
    1.41  				case StackBottom:
    1.42  					c->w = sw - 2 * BORDERPX;
    1.43 -					c->h = master - 2 * BORDERPX;
    1.44 +					c->h = md - 2 * BORDERPX;
    1.45  					break;
    1.46  				}
    1.47  			}
    1.48  			else {  /* tile window */
    1.49  				if(stackpos == StackRight)
    1.50 -					c->x += master;
    1.51 +					c->x += md;
    1.52  				if(th > bh) {
    1.53  					switch(stackpos) {
    1.54  					case StackLeft:
    1.55 @@ -166,7 +165,7 @@
    1.56  							c->h = sh - c->y - 2 * BORDERPX;
    1.57  						break;
    1.58  					case StackBottom:
    1.59 -						c->y = sy + master + (i - 1) * th + bh;
    1.60 +						c->y = sy + md + (i - 1) * th + bh;
    1.61  						if(i + 1 == n)
    1.62  							c->h = sh - c->y - 2 * BORDERPX;
    1.63  						break;
    1.64 @@ -176,7 +175,7 @@
    1.65  				}
    1.66  				else { /* fallback if th < bh */
    1.67  					if(stackpos == StackBottom)
    1.68 -						c->y += master;
    1.69 +						c->y += md;
    1.70  					c->w = stackw - 2 * BORDERPX;
    1.71  					c->h = stackh - 2 * BORDERPX;
    1.72  				}
    1.73 @@ -238,7 +237,6 @@
    1.74  
    1.75  void
    1.76  resizecol(Arg *arg) {
    1.77 -	int s;
    1.78  	unsigned int n;
    1.79  	Client *c;
    1.80  
    1.81 @@ -248,14 +246,13 @@
    1.82  	if(!sel || sel->isfloat || n < 2 || (arrange == dofloat))
    1.83  		return;
    1.84  
    1.85 -	s = stackpos == StackBottom ? sh - bh : sw;
    1.86  	if(sel == getnext(clients)) {
    1.87 -		if(master + arg->i > s - MINDIM || master + arg->i < MINDIM)
    1.88 +		if(master + arg->i > 95 || master + arg->i < 5)
    1.89  			return;
    1.90  		master += arg->i;
    1.91  	}
    1.92  	else {
    1.93 -		if(master - arg->i > s - MINDIM || master - arg->i < MINDIM)
    1.94 +		if(master - arg->i > 95 || master - arg->i < 5)
    1.95  			return;
    1.96  		master -= arg->i;
    1.97  	}
    1.98 @@ -321,7 +318,6 @@
    1.99  		stackpos = STACKPOS;
   1.100  	else
   1.101  		stackpos = StackBottom;
   1.102 -	master = ((stackpos == StackBottom ? sh - bh : sw) * MASTER) / 100;
   1.103  	arrange(NULL);
   1.104  }
   1.105