dwm-meillo

changeset 52:d18f6dd0cf23

fixed several things, nearly feature complete
author Anselm R. Garbe <garbeam@wmii.de>
date Thu, 13 Jul 2006 20:28:19 +0200
parents 035617ee18d1
children 529901e6a227
files TODO client.c dev.c dwm.h main.c
diffstat 5 files changed, 35 insertions(+), 29 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/TODO	Thu Jul 13 20:28:19 2006 +0200
     1.3 @@ -0,0 +1,1 @@
     1.4 +- improve mouse based resizals with quadrant approach (then I think we have feature completeness already)
     2.1 --- a/client.c	Thu Jul 13 19:55:07 2006 +0200
     2.2 +++ b/client.c	Thu Jul 13 20:28:19 2006 +0200
     2.3 @@ -52,7 +52,7 @@
     2.4  	sel->w = sw - 2 * sel->border;
     2.5  	sel->h = sh - 2 * sel->border;
     2.6  	craise(sel);
     2.7 -	resize(sel);
     2.8 +	resize(sel, False);
     2.9  	discard_events(EnterWindowMask);
    2.10  }
    2.11  
    2.12 @@ -100,7 +100,7 @@
    2.13  	arrange = floating;
    2.14  	for(c = clients; c; c = c->next) {
    2.15  		if(c->tags[tsel])
    2.16 -			resize(c);
    2.17 +			resize(c, True);
    2.18  		else
    2.19  			ban_client(c);
    2.20  	}
    2.21 @@ -125,29 +125,29 @@
    2.22  		if(c->tags[tsel])
    2.23  			n++;
    2.24  
    2.25 -	h = (n > 2) ? sh / (n - 2) : sh;
    2.26 +	h = (n > 1) ? sh / (n - 1) : sh;
    2.27  
    2.28  	for(i = 0, c = clients; c; c = c->next) {
    2.29  		if(c->tags[tsel]) {
    2.30  			if(n == 1) {
    2.31  				c->x = sx;
    2.32  				c->y = sy;
    2.33 -				c->w = sw;
    2.34 -				c->h = sh;
    2.35 +				c->w = sw - 2 * c->border;
    2.36 +				c->h = sh - 2 * c->border;
    2.37  			}
    2.38 -			else if(i == 1) {
    2.39 +			else if(i == 0) {
    2.40  				c->x = sx;
    2.41  				c->y = sy;
    2.42 -				c->w = mw;
    2.43 -				c->h = sh;
    2.44 +				c->w = mw - 2 * c->border;
    2.45 +				c->h = sh - 2 * c->border;
    2.46  			}
    2.47  			else {
    2.48  				c->x = sx + mw;
    2.49 -				c->y = sy + (i - 2) * h;
    2.50 -				c->w = w;
    2.51 -				c->h = h;
    2.52 +				c->y = sy + (i - 1) * h;
    2.53 +				c->w = w - 2 * c->border;
    2.54 +				c->h = h - 2 * c->border;
    2.55  			}
    2.56 -			resize(c);
    2.57 +			resize(c, False);
    2.58  			i++;
    2.59  		}
    2.60  		else
    2.61 @@ -304,14 +304,11 @@
    2.62  void
    2.63  focus(Client *c)
    2.64  {
    2.65 -	if(sel && sel != c) {
    2.66 -		XSetWindowBorder(dpy, sel->win, dc.bg);
    2.67 -		XMapWindow(dpy, sel->title);
    2.68 -		draw_client(sel);
    2.69 -	}
    2.70 +	Client *old = sel;
    2.71 +
    2.72  	sel = c;
    2.73 -	XUnmapWindow(dpy, c->title);
    2.74 -	XSetWindowBorder(dpy, c->win, dc.fg);
    2.75 +	if(old && old != c)
    2.76 +		draw_client(old);
    2.77  	draw_client(c);
    2.78  	XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
    2.79  	XFlush(dpy);
    2.80 @@ -463,14 +460,16 @@
    2.81  
    2.82  
    2.83  void
    2.84 -resize(Client *c)
    2.85 +resize(Client *c, Bool inc)
    2.86  {
    2.87  	XConfigureEvent e;
    2.88  
    2.89 -	if(c->incw)
    2.90 -		c->w -= (c->w - c->basew) % c->incw;
    2.91 -	if(c->inch)
    2.92 -		c->h -= (c->h - c->baseh) % c->inch;
    2.93 +	if(inc) {
    2.94 +		if(c->incw)
    2.95 +			c->w -= (c->w - c->basew) % c->incw;
    2.96 +		if(c->inch)
    2.97 +			c->h -= (c->h - c->baseh) % c->inch;
    2.98 +	}
    2.99  	if(c->minw && c->w < c->minw)
   2.100  		c->w = c->minw;
   2.101  	if(c->minh && c->h < c->minh)
   2.102 @@ -554,8 +553,14 @@
   2.103  draw_client(Client *c)
   2.104  {
   2.105  	int i;
   2.106 -	if(c == sel)
   2.107 +	if(c == sel) {
   2.108 +		XUnmapWindow(dpy, c->title);
   2.109 +		XSetWindowBorder(dpy, c->win, dc.fg);
   2.110  		return;
   2.111 +	}
   2.112 +
   2.113 +	XSetWindowBorder(dpy, c->win, dc.bg);
   2.114 +	XMapWindow(dpy, c->title);
   2.115  
   2.116  	dc.x = dc.y = 0;
   2.117  	dc.h = c->th;
     3.1 --- a/dev.c	Thu Jul 13 19:55:07 2006 +0200
     3.2 +++ b/dev.c	Thu Jul 13 20:28:19 2006 +0200
     3.3 @@ -104,7 +104,7 @@
     3.4  			c->h = abs(ocy - ev.xmotion.y);
     3.5  			c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w;
     3.6  			c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h;
     3.7 -			resize(c);
     3.8 +			resize(c, True);
     3.9  			break;
    3.10  		case ButtonRelease:
    3.11  			XUngrabPointer(dpy, CurrentTime);
    3.12 @@ -138,7 +138,7 @@
    3.13  			XFlush(dpy);
    3.14  			c->x = ocx + (ev.xmotion.x - x1);
    3.15  			c->y = ocy + (ev.xmotion.y - y1);
    3.16 -			resize(c);
    3.17 +			resize(c, False);
    3.18  			break;
    3.19  		case ButtonRelease:
    3.20  			XUngrabPointer(dpy, CurrentTime);
     4.1 --- a/dwm.h	Thu Jul 13 19:55:07 2006 +0200
     4.2 +++ b/dwm.h	Thu Jul 13 20:28:19 2006 +0200
     4.3 @@ -106,7 +106,7 @@
     4.4  extern void focus(Client *c);
     4.5  extern void update_name(Client *c);
     4.6  extern void draw_client(Client *c);
     4.7 -extern void resize(Client *c);
     4.8 +extern void resize(Client *c, Bool inc);
     4.9  extern void update_size(Client *c);
    4.10  extern Client *gettitle(Window w);
    4.11  extern void craise(Client *c);
     5.1 --- a/main.c	Thu Jul 13 19:55:07 2006 +0200
     5.2 +++ b/main.c	Thu Jul 13 20:28:19 2006 +0200
     5.3 @@ -168,7 +168,7 @@
     5.4  cleanup()
     5.5  {
     5.6  	while(sel) {
     5.7 -		resize(sel);
     5.8 +		resize(sel, True);
     5.9  		unmanage(sel);
    5.10  	}
    5.11  	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);