dwm-meillo

changeset 399:74739798b0b2

simplified buttonpress
author Anselm R. Garbe <arg@10kloc.org>
date Fri, 01 Sep 2006 15:31:59 +0200
parents 9c703e528e58
children 052657ff2e7b
files event.c
diffstat 1 files changed, 12 insertions(+), 23 deletions(-) [+]
line diff
     1.1 --- a/event.c	Fri Sep 01 10:32:50 2006 +0200
     1.2 +++ b/event.c	Fri Sep 01 15:31:59 2006 +0200
     1.3 @@ -109,19 +109,17 @@
     1.4  		for(a.i = 0; a.i < ntags; a.i++) {
     1.5  			x += textw(tags[a.i]);
     1.6  			if(ev->x < x) {
     1.7 -				switch(ev->button) {
     1.8 -				case Button1:
     1.9 +				if(ev->button == Button1) {
    1.10  					if(ev->state & MODKEY)
    1.11  						tag(&a);
    1.12  					else
    1.13  						view(&a);
    1.14 -					break;
    1.15 -				case Button3:
    1.16 +				}
    1.17 +				else if(ev->button == Button3) {
    1.18  					if(ev->state & MODKEY)
    1.19  						toggletag(&a);
    1.20  					else
    1.21  						toggleview(&a);
    1.22 -					break;
    1.23  				}
    1.24  				return;
    1.25  			}
    1.26 @@ -133,26 +131,17 @@
    1.27  	}
    1.28  	else if((c = getclient(ev->window))) {
    1.29  		focus(c);
    1.30 -		if(CLEANMASK(ev->state) != MODKEY)
    1.31 +		if(c->ismax || CLEANMASK(ev->state) != MODKEY)
    1.32  			return;
    1.33 -		switch(ev->button) {
    1.34 -		default:
    1.35 -			break;
    1.36 -		case Button1:
    1.37 -			if(!c->ismax && (arrange == dofloat || c->isfloat)) {
    1.38 -				restack(c);
    1.39 -				movemouse(c);
    1.40 -			}
    1.41 -			break;
    1.42 -		case Button2:
    1.43 +		if((ev->button == Button1) && ((arrange == dofloat) || c->isfloat)) {
    1.44 +			restack(c);
    1.45 +			movemouse(c);
    1.46 +		}
    1.47 +		else if(ev->button == Button2)
    1.48  			zoom(NULL);
    1.49 -			break;
    1.50 -		case Button3:
    1.51 -			if(!c->ismax && (arrange == dofloat || c->isfloat)) {
    1.52 -				restack(c);
    1.53 -				resizemouse(c);
    1.54 -			}
    1.55 -			break;
    1.56 +		else if(ev->button == Button3 && ((arrange == dofloat) || c->isfloat)) {
    1.57 +			restack(c);
    1.58 +			resizemouse(c);
    1.59  		}
    1.60  	}
    1.61  }