changeset 4:a54de16f8277

fix taskbar behavior when exceeding MAX_TASKS; bound moveresize() to windowarea
author paulo@localhost
date Fri, 24 Apr 2009 01:34:17 -0700
parents faa4cb9d7bd6
children e060ab82b136
files client.c config.h event.c
diffstat 3 files changed, 23 insertions(+), 10 deletions(-) [+]
line diff
     1.1 --- a/client.c	Thu Apr 23 02:43:13 2009 -0700
     1.2 +++ b/client.c	Fri Apr 24 01:34:17 2009 -0700
     1.3 @@ -500,6 +500,19 @@
     1.4  	nw = wAbs == 'W' ? w : sel->w + w;
     1.5  	nh = hAbs == 'H' ? h : sel->h + h;
     1.6  
     1.7 +	if(xAbs == 'X') {
     1.8 +		if(nx < wax)
     1.9 +			nx = wax;
    1.10 +		else if(nx + nw + 2*BORDERPX > waw)
    1.11 +			nx = wax + waw - nw - 2*BORDERPX;
    1.12 +	}
    1.13 +	if(yAbs == 'Y') {
    1.14 +		if(ny < way)
    1.15 +			ny = way;
    1.16 +		else if(ny + nh + 2*BORDERPX > wah)
    1.17 +			ny = way + wah - nh - 2*BORDERPX;
    1.18 +	}
    1.19 +
    1.20  	ox = sel->x;
    1.21  	oy = sel->y;
    1.22  	ow = sel->w;
     2.1 --- a/config.h	Thu Apr 23 02:43:13 2009 -0700
     2.2 +++ b/config.h	Fri Apr 24 01:34:17 2009 -0700
     2.3 @@ -126,11 +126,11 @@
     2.4  	{ MODKEY|ControlMask,		XK_h,		moveresize,		"0X 0y 0w 0h" }, \
     2.5  	{ MODKEY|ControlMask,		XK_l,		moveresize,		"9000X 0y 0w 0h" }, \
     2.6  	{ MODKEY|ControlMask,		XK_j,		moveresize,		"0x 9000Y 0w 0h" }, \
     2.7 -	{ MODKEY|ControlMask,		XK_k,		moveresize,		"0x 15Y 0w 0h" }, \
     2.8 +	{ MODKEY|ControlMask,		XK_k,		moveresize,		"0x 0Y 0w 0h" }, \
     2.9  	{ MODKEY|ShiftMask,		XK_h,		moveresize,		"0x 0y -25w 0h" }, \
    2.10  	{ MODKEY|ShiftMask,		XK_l,		moveresize,		"0x 0y 25w 0h" }, \
    2.11  	{ MODKEY|ShiftMask,		XK_j,		moveresize,		"0x 0y 0w 25h" }, \
    2.12  	{ MODKEY|ShiftMask,		XK_k,		moveresize,		"0x 0y 0w -25h" }, \
    2.13  };
    2.14  
    2.15 -#define MAX_TASKS		10		/* max number of apps in taskbar */
    2.16 +#define MAX_TASKS		13		/* max number of apps in taskbar */
     3.1 --- a/event.c	Thu Apr 23 02:43:13 2009 -0700
     3.2 +++ b/event.c	Fri Apr 24 01:34:17 2009 -0700
     3.3 @@ -167,18 +167,18 @@
     3.4  	}
     3.5  	else if(tbarwin == ev->window) {
     3.6  		int i, w;
     3.7 +		for(i=0, c = clients; c; c = c->next) {
     3.8 +			if(isvisible(c))
     3.9 +				i++;
    3.10 +		}
    3.11 +		if(!i || i >= MAX_TASKS)
    3.12 +			return;
    3.13 +		else
    3.14 +			w = sw/i;
    3.15  		switch(ev->button) {
    3.16  			case Button4: focusprev(NULL); return; break;
    3.17  			case Button5: focusnext(NULL); return; break;
    3.18  		}
    3.19 -		for(i=0, c = clients; c; c = c->next) {
    3.20 -			if(isvisible(c))
    3.21 -				i++;
    3.22 -		}
    3.23 -		if(!i && i >= MAX_TASKS)
    3.24 -			return;
    3.25 -		else
    3.26 -			w = sw/i;
    3.27  		for(i=1, c = clients; c && i*w<=sw; c = c->next, i++) {
    3.28  			for(; c && !isvisible(c); c = c->next);
    3.29  			if(i*w > ev->x) {