aewl

changeset 565:fe766305eed1

applied Gottox' windowarea patch
author arg@mig29
date Thu, 16 Nov 2006 14:40:57 +0100
parents a22a70174d44
children 91b6cbcdfc71
files dwm.h event.c main.c view.c
diffstat 4 files changed, 32 insertions(+), 32 deletions(-) [+]
line diff
     1.1 --- a/dwm.h	Wed Nov 08 17:16:38 2006 +0100
     1.2 +++ b/dwm.h	Thu Nov 16 14:40:57 2006 +0100
     1.3 @@ -96,6 +96,7 @@
     1.4  extern char stext[1024];			/* status text */
     1.5  extern int bx, by, bw, bh, bmw;			/* bar geometry, bar mode label width */
     1.6  extern int screen, sx, sy, sw, sh;		/* screen geometry */
     1.7 +extern int wax, way, wah, waw;			/* windowarea geometry */
     1.8  extern unsigned int master, ntags, numlockmask;	/* master percent, number of tags, dynamic lock mask */
     1.9  extern void (*handler[LASTEvent])(XEvent *);	/* event handler */
    1.10  extern void (*arrange)(void);			/* arrange function, indicates mode  */
     2.1 --- a/event.c	Wed Nov 08 17:16:38 2006 +0100
     2.2 +++ b/event.c	Thu Nov 16 14:40:57 2006 +0100
     2.3 @@ -48,14 +48,14 @@
     2.4  			XSync(dpy, False);
     2.5  			c->x = ocx + (ev.xmotion.x - x1);
     2.6  			c->y = ocy + (ev.xmotion.y - y1);
     2.7 -			if(abs(sx + c->x) < SNAP)
     2.8 -				c->x = sx;
     2.9 -			else if(abs((sx + sw) - (c->x + c->w)) < SNAP)
    2.10 -				c->x = sw - c->w - 2 * BORDERPX;
    2.11 -			if(abs((sy + bh) - c->y) < SNAP)
    2.12 -				c->y = sy + bh;
    2.13 -			else if(abs((sy + sh) - (c->y + c->h)) < SNAP)
    2.14 -				c->y = sh - c->h - 2 * BORDERPX;
    2.15 +			if(abs(wax + c->x) < SNAP)
    2.16 +				c->x = wax;
    2.17 +			else if(abs((wax + waw) - (c->x + c->w)) < SNAP)
    2.18 +				c->x = wax + waw - c->w - 2 * BORDERPX;
    2.19 +			if(abs(way - c->y) < SNAP)
    2.20 +				c->y = way;
    2.21 +			else if(abs((way + wah) - (c->y + c->h)) < SNAP)
    2.22 +				c->y = way + wah - c->h - 2 * BORDERPX;
    2.23  			resize(c, False, TopLeft);
    2.24  			break;
    2.25  		}
     3.1 --- a/main.c	Wed Nov 08 17:16:38 2006 +0100
     3.2 +++ b/main.c	Thu Nov 16 14:40:57 2006 +0100
     3.3 @@ -18,7 +18,7 @@
     3.4  
     3.5  char stext[1024];
     3.6  Bool *seltag;
     3.7 -int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh;
     3.8 +int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh, wax, way, waw, wah;
     3.9  unsigned int master, ntags, numlockmask;
    3.10  Atom wmatom[WMLast], netatom[NetLast];
    3.11  Bool running = True;
    3.12 @@ -142,6 +142,11 @@
    3.13  	XDefineCursor(dpy, barwin, cursor[CurNormal]);
    3.14  	XMapRaised(dpy, barwin);
    3.15  	strcpy(stext, "dwm-"VERSION);
    3.16 +	/* windowarea */
    3.17 +	wax = sx;
    3.18 +	way = bh;
    3.19 +	wah = sh - bh;
    3.20 +	waw = sw;
    3.21  	/* pixmap for everything */
    3.22  	dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
    3.23  	dc.gc = XCreateGC(dpy, root, 0, 0);
     4.1 --- a/view.c	Wed Nov 08 17:16:38 2006 +0100
     4.2 +++ b/view.c	Thu Nov 16 14:40:57 2006 +0100
     4.3 @@ -49,10 +49,10 @@
     4.4  		return;
     4.5  
     4.6  	if((c->ismax = !c->ismax)) {
     4.7 -		c->rx = c->x; c->x = sx;
     4.8 -		c->ry = c->y; c->y = bh;
     4.9 -		c->rw = c->w; c->w = sw - 2 * BORDERPX;
    4.10 -		c->rh = c->h; c->h = sh - bh - 2 * BORDERPX;
    4.11 +		c->rx = c->x; c->x = wax;
    4.12 +		c->ry = c->y; c->y = way;
    4.13 +		c->rw = c->w; c->w = waw - 2 * BORDERPX;
    4.14 +		c->rh = c->h; c->h = wah - 2 * BORDERPX;
    4.15  	}
    4.16  	else {
    4.17  		c->x = c->rx;
    4.18 @@ -99,17 +99,13 @@
    4.19  
    4.20  void
    4.21  dotile(void) {
    4.22 -	unsigned int i, n, mpx, stackw, stackh, th;
    4.23 +	unsigned int i, n, mpx, stackw, th;
    4.24  	Client *c;
    4.25  
    4.26  	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
    4.27  		n++;
    4.28 -	mpx = (sw * master) / 1000;
    4.29 -	stackw = sw - mpx;
    4.30 -	stackh = sh - bh;
    4.31 -	th = stackh;
    4.32 -	if(n > 1)
    4.33 -		th /= (n - 1);
    4.34 +	mpx = (waw * master) / 1000;
    4.35 +	stackw = waw - mpx;
    4.36  
    4.37  	for(i = 0, c = clients; c; c = c->next)
    4.38  		if(isvisible(c)) {
    4.39 @@ -118,28 +114,26 @@
    4.40  				continue;
    4.41  			}
    4.42  			c->ismax = False;
    4.43 -			c->x = sx;
    4.44 -			c->y = sy + bh;
    4.45 +			c->x = wax;
    4.46 +			c->y = way;
    4.47  			if(n == 1) { /* only 1 window */
    4.48 -				c->w = sw - 2 * BORDERPX;
    4.49 -				c->h = sh - 2 * BORDERPX - bh;
    4.50 +				c->w = waw - 2 * BORDERPX;
    4.51 +				c->h = wah - 2 * BORDERPX;
    4.52  			}
    4.53  			else if(i == 0) { /* master window */
    4.54 -				c->w = mpx - 2 * BORDERPX;
    4.55 -				c->h = sh - bh - 2 * BORDERPX;
    4.56 +				c->w = waw - stackw - 2 * BORDERPX;
    4.57 +				c->h = wah - 2 * BORDERPX;
    4.58 +				th = wah / (n - 1);
    4.59  			}
    4.60  			else {  /* tile window */
    4.61  				c->x += mpx;
    4.62  				c->w = stackw - 2 * BORDERPX;
    4.63  				if(th > bh) {
    4.64 -					c->y = sy + (i - 1) * th + bh;
    4.65 -					if(i + 1 == n)
    4.66 -						c->h = sh - c->y - 2 * BORDERPX;
    4.67 -					else
    4.68 -						c->h = th - 2 * BORDERPX;
    4.69 +					c->y = way + (i - 1) * th;
    4.70 +					c->h = th - 2 * BORDERPX;
    4.71  				}
    4.72  				else /* fallback if th < bh */
    4.73 -					c->h = stackh - 2 * BORDERPX;
    4.74 +					c->h = wah - 2 * BORDERPX;
    4.75  			}
    4.76  			resize(c, False, TopLeft);
    4.77  			i++;