about summary refs log tree commit diff stats
path: root/event.c
diff options
context:
space:
mode:
authorarg@10ksloc.org <unknown>2006-07-19 11:31:04 +0200
committerarg@10ksloc.org <unknown>2006-07-19 11:31:04 +0200
commitc53980cddcee8afd13ea793134ed3ddf5dbef0e3 (patch)
tree44d98af7d722ffabac12eb271b81a74f9bd49834 /event.c
parent95e56ffc0d91f55dcb138b25b6788378971485a5 (diff)
downloaddwm-c53980cddcee8afd13ea793134ed3ddf5dbef0e3.tar.gz
applied Sanders resize patch, fixed lower bug
Diffstat (limited to 'event.c')
-rw-r--r--event.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/event.c b/event.c
index db95dfd..9d69373 100644
--- a/event.c
+++ b/event.c
@@ -79,7 +79,7 @@ movemouse(Client *c)
 			XSync(dpy, False);
 			*c->x = ocx + (ev.xmotion.x - x1);
 			*c->y = ocy + (ev.xmotion.y - y1);
-			resize(c, False);
+			resize(c, False, TopLeft);
 			break;
 		case ButtonRelease:
 			XUngrabPointer(dpy, CurrentTime);
@@ -93,6 +93,7 @@ resizemouse(Client *c)
 {
 	XEvent ev;
 	int ocx, ocy;
+	Corner sticky;
 
 	ocx = *c->x;
 	ocy = *c->y;
@@ -113,7 +114,18 @@ resizemouse(Client *c)
 			*c->h = abs(ocy - ev.xmotion.y);
 			*c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - *c->w;
 			*c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - *c->h;
-			resize(c, True);
+			if(ocx <= ev.xmotion.x) {
+				if(ocy <= ev.xmotion.y)
+					sticky = TopLeft;
+				else
+					sticky = BottomLeft;
+			} else {
+				if(ocy <= ev.xmotion.y)
+					sticky = TopRight;
+				else
+					sticky = BottomRight;
+			}
+			resize(c, True, sticky);
 			break;
 		case ButtonRelease:
 			XUngrabPointer(dpy, CurrentTime);
@@ -153,24 +165,27 @@ buttonpress(XEvent *e)
 		}
 	}
 	else if((c = getclient(ev->window))) {
-		if(arrange == dotile && !c->isfloat) {
-			if((ev->state & ControlMask) && (ev->button == Button1))
-				zoom(NULL);
-			return;
-		}
-		/* floating windows */
-		higher(c);
 		switch(ev->button) {
 		default:
 			break;
 		case Button1:
-			movemouse(c);
+			if(arrange == dotile && !c->isfloat) {
+				if((ev->state & ControlMask) && (ev->button == Button1))
+					zoom(NULL);
+			}
+			else {
+				higher(c);
+				movemouse(c);
+			}
 			break;
 		case Button2:
 			lower(c);
 			break;
 		case Button3:
-			resizemouse(c);
+			if(arrange == dofloat || c->isfloat) {
+				higher(c);
+				resizemouse(c);
+			}
 			break;
 		}
 	}
@@ -197,7 +212,7 @@ configurerequest(XEvent *e)
 		if(ev->value_mask & CWBorderWidth)
 			c->border = 1;
 		gravitate(c, False);
-		resize(c, True);
+		resize(c, True, TopLeft);
 	}
 
 	wc.x = ev->x;
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312