aewl

diff event.c @ 99:a19556fe83b5

applied Sanders resize patch, fixed lower bug
author arg@10ksloc.org
date Wed, 19 Jul 2006 11:31:04 +0200
parents 5d88952cbf96
children 3e74cc981e9b
line diff
     1.1 --- a/event.c	Tue Jul 18 17:54:55 2006 +0200
     1.2 +++ b/event.c	Wed Jul 19 11:31:04 2006 +0200
     1.3 @@ -79,7 +79,7 @@
     1.4  			XSync(dpy, False);
     1.5  			*c->x = ocx + (ev.xmotion.x - x1);
     1.6  			*c->y = ocy + (ev.xmotion.y - y1);
     1.7 -			resize(c, False);
     1.8 +			resize(c, False, TopLeft);
     1.9  			break;
    1.10  		case ButtonRelease:
    1.11  			XUngrabPointer(dpy, CurrentTime);
    1.12 @@ -93,6 +93,7 @@
    1.13  {
    1.14  	XEvent ev;
    1.15  	int ocx, ocy;
    1.16 +	Corner sticky;
    1.17  
    1.18  	ocx = *c->x;
    1.19  	ocy = *c->y;
    1.20 @@ -113,7 +114,18 @@
    1.21  			*c->h = abs(ocy - ev.xmotion.y);
    1.22  			*c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - *c->w;
    1.23  			*c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - *c->h;
    1.24 -			resize(c, True);
    1.25 +			if(ocx <= ev.xmotion.x) {
    1.26 +				if(ocy <= ev.xmotion.y)
    1.27 +					sticky = TopLeft;
    1.28 +				else
    1.29 +					sticky = BottomLeft;
    1.30 +			} else {
    1.31 +				if(ocy <= ev.xmotion.y)
    1.32 +					sticky = TopRight;
    1.33 +				else
    1.34 +					sticky = BottomRight;
    1.35 +			}
    1.36 +			resize(c, True, sticky);
    1.37  			break;
    1.38  		case ButtonRelease:
    1.39  			XUngrabPointer(dpy, CurrentTime);
    1.40 @@ -153,24 +165,27 @@
    1.41  		}
    1.42  	}
    1.43  	else if((c = getclient(ev->window))) {
    1.44 -		if(arrange == dotile && !c->isfloat) {
    1.45 -			if((ev->state & ControlMask) && (ev->button == Button1))
    1.46 -				zoom(NULL);
    1.47 -			return;
    1.48 -		}
    1.49 -		/* floating windows */
    1.50 -		higher(c);
    1.51  		switch(ev->button) {
    1.52  		default:
    1.53  			break;
    1.54  		case Button1:
    1.55 -			movemouse(c);
    1.56 +			if(arrange == dotile && !c->isfloat) {
    1.57 +				if((ev->state & ControlMask) && (ev->button == Button1))
    1.58 +					zoom(NULL);
    1.59 +			}
    1.60 +			else {
    1.61 +				higher(c);
    1.62 +				movemouse(c);
    1.63 +			}
    1.64  			break;
    1.65  		case Button2:
    1.66  			lower(c);
    1.67  			break;
    1.68  		case Button3:
    1.69 -			resizemouse(c);
    1.70 +			if(arrange == dofloat || c->isfloat) {
    1.71 +				higher(c);
    1.72 +				resizemouse(c);
    1.73 +			}
    1.74  			break;
    1.75  		}
    1.76  	}
    1.77 @@ -197,7 +212,7 @@
    1.78  		if(ev->value_mask & CWBorderWidth)
    1.79  			c->border = 1;
    1.80  		gravitate(c, False);
    1.81 -		resize(c, True);
    1.82 +		resize(c, True, TopLeft);
    1.83  	}
    1.84  
    1.85  	wc.x = ev->x;