aewl

changeset 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 7433954e80af
files config.arg.h config.default.h dwm.h main.c view.c
diffstat 5 files changed, 20 insertions(+), 24 deletions(-) [+]
line diff
     1.1 --- a/config.arg.h	Thu Oct 05 12:18:04 2006 +0200
     1.2 +++ b/config.arg.h	Thu Oct 05 12:59:35 2006 +0200
     1.3 @@ -37,8 +37,8 @@
     1.4  	{ MODKEY,			XK_k,		focusprev,	{ 0 } }, \
     1.5  	{ MODKEY,			XK_Return,	zoom,		{ 0 } }, \
     1.6  	{ MODKEY,			XK_b,		togglestackpos,	{ 0 } }, \
     1.7 -	{ MODKEY,			XK_g,		resizecol,	{ .i = 20 } }, \
     1.8 -	{ MODKEY,			XK_s,		resizecol,	{ .i = -20 } }, \
     1.9 +	{ MODKEY,			XK_g,		resizecol,	{ .i = 1 } }, \
    1.10 +	{ MODKEY,			XK_s,		resizecol,	{ .i = -1 } }, \
    1.11  	{ MODKEY|ShiftMask,		XK_1,		tag,		{ .i = 0 } }, \
    1.12  	{ MODKEY|ShiftMask,		XK_2,		tag,		{ .i = 1 } }, \
    1.13  	{ MODKEY|ShiftMask,		XK_3,		tag,		{ .i = 2 } }, \
     2.1 --- a/config.default.h	Thu Oct 05 12:18:04 2006 +0200
     2.2 +++ b/config.default.h	Thu Oct 05 12:59:35 2006 +0200
     2.3 @@ -31,8 +31,8 @@
     2.4  	{ MODKEY|ShiftMask,		XK_Tab,		focusprev,	{ 0 } }, \
     2.5  	{ MODKEY,			XK_Return,	zoom,		{ 0 } }, \
     2.6  	{ MODKEY,			XK_b,		togglestackpos,	{ 0 } }, \
     2.7 -	{ MODKEY,			XK_g,		resizecol,	{ .i = 20 } }, \
     2.8 -	{ MODKEY,			XK_s,		resizecol,	{ .i = -20 } }, \
     2.9 +	{ MODKEY,			XK_g,		resizecol,	{ .i = 1 } }, \
    2.10 +	{ MODKEY,			XK_s,		resizecol,	{ .i = -1 } }, \
    2.11  	{ MODKEY|ShiftMask,		XK_1,		tag,		{ .i = 0 } }, \
    2.12  	{ MODKEY|ShiftMask,		XK_2,		tag,		{ .i = 1 } }, \
    2.13  	{ MODKEY|ShiftMask,		XK_3,		tag,		{ .i = 2 } }, \
     3.1 --- a/dwm.h	Thu Oct 05 12:18:04 2006 +0200
     3.2 +++ b/dwm.h	Thu Oct 05 12:59:35 2006 +0200
     3.3 @@ -101,8 +101,8 @@
     3.4  extern const char *tags[];			/* all tags */
     3.5  extern char stext[1024];			/* status text */
     3.6  extern int bx, by, bw, bh, bmw;			/* bar geometry, bar mode label width */
     3.7 -extern int master, screen, sx, sy, sw, sh;	/* screen geometry, master dimension*/
     3.8 -extern unsigned int ntags, numlockmask;		/* number of tags, dynamic lock mask */
     3.9 +extern int screen, sx, sy, sw, sh;		/* screen geometry */
    3.10 +extern unsigned int master, ntags, numlockmask;	/* master percent, number of tags, dynamic lock mask */
    3.11  extern void (*handler[LASTEvent])(XEvent *);	/* event handler */
    3.12  extern void (*arrange)(Arg *);			/* arrange function, indicates mode  */
    3.13  extern Atom wmatom[WMLast], netatom[NetLast];
    3.14 @@ -168,7 +168,7 @@
    3.15  extern void focusnext(Arg *arg);		/* focuses next visible client, arg is ignored  */
    3.16  extern void focusprev(Arg *arg);		/* focuses previous visible client, arg is ignored */
    3.17  extern Bool isvisible(Client *c);		/* returns True if client is visible */
    3.18 -extern void resizecol(Arg *arg);		/* resizes the master dimension with arg's index value */
    3.19 +extern void resizecol(Arg *arg);		/* resizes the master percent with arg's index value */
    3.20  extern void restack(void);			/* restores z layers of all clients */
    3.21  extern void togglestackpos(Arg *arg);		/* toggles stack position */
    3.22  extern void togglemode(Arg *arg);		/* toggles global arrange function (dotile/dofloat) */
     4.1 --- a/main.c	Thu Oct 05 12:18:04 2006 +0200
     4.2 +++ b/main.c	Thu Oct 05 12:59:35 2006 +0200
     4.3 @@ -19,8 +19,8 @@
     4.4  
     4.5  char stext[1024];
     4.6  Bool *seltag;
     4.7 -int bx, by, bw, bh, bmw, master, screen, sx, sy, sw, sh;
     4.8 -unsigned int ntags, numlockmask;
     4.9 +int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh;
    4.10 +unsigned int master, ntags, numlockmask;
    4.11  Atom wmatom[WMLast], netatom[NetLast];
    4.12  Bool running = True;
    4.13  Bool issel = True;
    4.14 @@ -136,7 +136,7 @@
    4.15  	sx = sy = 0;
    4.16  	sw = DisplayWidth(dpy, screen);
    4.17  	sh = DisplayHeight(dpy, screen);
    4.18 -	master = ((stackpos == StackBottom ? sh - bh : sw) * MASTER) / 100;
    4.19 +	master = MASTER;
    4.20  
    4.21  	bx = by = 0;
    4.22  	bw = sw;
     5.1 --- a/view.c	Thu Oct 05 12:18:04 2006 +0200
     5.2 +++ b/view.c	Thu Oct 05 12:59:35 2006 +0200
     5.3 @@ -4,8 +4,6 @@
     5.4   */
     5.5  #include "dwm.h"
     5.6  
     5.7 -#define MINDIM			100
     5.8 -
     5.9  /* static */
    5.10  
    5.11  static Client *
    5.12 @@ -106,6 +104,7 @@
    5.13  void
    5.14  dotile(Arg *arg) {
    5.15  	int i, n, stackw, stackh, tw, th;
    5.16 +	unsigned int md = ((stackpos == StackBottom ? sh - bh : sw) * master) / 100;
    5.17  	Client *c;
    5.18  
    5.19  	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
    5.20 @@ -113,10 +112,10 @@
    5.21  
    5.22  	if(stackpos == StackBottom) {
    5.23  		stackw = sw;
    5.24 -		stackh = sh - bh - master;
    5.25 +		stackh = sh - bh - md;
    5.26  	}
    5.27  	else {
    5.28 -		stackw = sw - master;
    5.29 +		stackw = sw - md;
    5.30  		stackh = sh - bh;
    5.31  	}
    5.32  
    5.33 @@ -145,18 +144,18 @@
    5.34  				switch(stackpos) {
    5.35  				case StackLeft:
    5.36  				case StackRight:
    5.37 -					c->w = master - 2 * BORDERPX;
    5.38 +					c->w = md - 2 * BORDERPX;
    5.39  					c->h = sh - bh - 2 * BORDERPX;
    5.40  					break;
    5.41  				case StackBottom:
    5.42  					c->w = sw - 2 * BORDERPX;
    5.43 -					c->h = master - 2 * BORDERPX;
    5.44 +					c->h = md - 2 * BORDERPX;
    5.45  					break;
    5.46  				}
    5.47  			}
    5.48  			else {  /* tile window */
    5.49  				if(stackpos == StackRight)
    5.50 -					c->x += master;
    5.51 +					c->x += md;
    5.52  				if(th > bh) {
    5.53  					switch(stackpos) {
    5.54  					case StackLeft:
    5.55 @@ -166,7 +165,7 @@
    5.56  							c->h = sh - c->y - 2 * BORDERPX;
    5.57  						break;
    5.58  					case StackBottom:
    5.59 -						c->y = sy + master + (i - 1) * th + bh;
    5.60 +						c->y = sy + md + (i - 1) * th + bh;
    5.61  						if(i + 1 == n)
    5.62  							c->h = sh - c->y - 2 * BORDERPX;
    5.63  						break;
    5.64 @@ -176,7 +175,7 @@
    5.65  				}
    5.66  				else { /* fallback if th < bh */
    5.67  					if(stackpos == StackBottom)
    5.68 -						c->y += master;
    5.69 +						c->y += md;
    5.70  					c->w = stackw - 2 * BORDERPX;
    5.71  					c->h = stackh - 2 * BORDERPX;
    5.72  				}
    5.73 @@ -238,7 +237,6 @@
    5.74  
    5.75  void
    5.76  resizecol(Arg *arg) {
    5.77 -	int s;
    5.78  	unsigned int n;
    5.79  	Client *c;
    5.80  
    5.81 @@ -248,14 +246,13 @@
    5.82  	if(!sel || sel->isfloat || n < 2 || (arrange == dofloat))
    5.83  		return;
    5.84  
    5.85 -	s = stackpos == StackBottom ? sh - bh : sw;
    5.86  	if(sel == getnext(clients)) {
    5.87 -		if(master + arg->i > s - MINDIM || master + arg->i < MINDIM)
    5.88 +		if(master + arg->i > 95 || master + arg->i < 5)
    5.89  			return;
    5.90  		master += arg->i;
    5.91  	}
    5.92  	else {
    5.93 -		if(master - arg->i > s - MINDIM || master - arg->i < MINDIM)
    5.94 +		if(master - arg->i > 95 || master - arg->i < 5)
    5.95  			return;
    5.96  		master -= arg->i;
    5.97  	}
    5.98 @@ -321,7 +318,6 @@
    5.99  		stackpos = STACKPOS;
   5.100  	else
   5.101  		stackpos = StackBottom;
   5.102 -	master = ((stackpos == StackBottom ? sh - bh : sw) * MASTER) / 100;
   5.103  	arrange(NULL);
   5.104  }
   5.105