summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorokan <okan>2013-01-08 04:12:51 +0000
committerokan <okan>2013-01-08 04:12:51 +0000
commitbf9d9815976c0afae2e87afeebaa57b02b1d911c (patch)
tree04bbefefe007df702c689a7ccf38b770f3dbae07 /client.c
parente7b85cfb2f4d04e283d448cc3a09014e858eeb94 (diff)
downloadcwm-bf9d9815976c0afae2e87afeebaa57b02b1d911c.tar.gz
cwm-bf9d9815976c0afae2e87afeebaa57b02b1d911c.tar.xz
cwm-bf9d9815976c0afae2e87afeebaa57b02b1d911c.zip
teach screen_find_xinerama() about gap and adjust (simplify) callers;
menu becomes gap-aware for free.
Diffstat (limited to 'client.c')
-rw-r--r--client.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/client.c b/client.c
index 6fcfb88..459d024 100644
--- a/client.c
+++ b/client.c
@@ -286,10 +286,7 @@ client_maximize(struct client_ctx *cc)
 	    cc->geom.x + cc->geom.w / 2,
 	    cc->geom.y + cc->geom.h / 2);
 
-	cc->geom.x = xine.x + sc->gap.left;
-	cc->geom.y = xine.y + sc->gap.top;
-	cc->geom.h = xine.h - (sc->gap.top + sc->gap.bottom);
-	cc->geom.w = xine.w - (sc->gap.left + sc->gap.right);
+	cc->geom = xine;
 	cc->bwidth = 0;
 	cc->flags |= CLIENT_MAXIMIZED;
 
@@ -329,9 +326,8 @@ client_vmaximize(struct client_ctx *cc)
 	    cc->geom.x + cc->geom.w / 2,
 	    cc->geom.y + cc->geom.h / 2);
 
-	cc->geom.y = xine.y + sc->gap.top;
-	cc->geom.h = xine.h - (cc->bwidth * 2) - (sc->gap.top +
-	    sc->gap.bottom);
+	cc->geom.y = xine.y;
+	cc->geom.h = xine.h - (cc->bwidth * 2);
 	cc->flags |= CLIENT_VMAXIMIZED;
 
 resize:
@@ -370,9 +366,8 @@ client_hmaximize(struct client_ctx *cc)
 	    cc->geom.x + cc->geom.w / 2,
 	    cc->geom.y + cc->geom.h / 2);
 
-	cc->geom.x = xine.x + sc->gap.left;
-	cc->geom.w = xine.w - (cc->bwidth * 2) - (sc->gap.left +
-	    sc->gap.right);
+	cc->geom.x = xine.x;
+	cc->geom.w = xine.w - (cc->bwidth * 2);
 	cc->flags |= CLIENT_HMAXIMIZED;
 
 resize:
@@ -672,22 +667,16 @@ client_placecalc(struct client_ctx *cc)
 		yslack = xine.h - cc->geom.h - cc->bwidth * 2;
 
 		if (xslack >= xine.x) {
-			cc->geom.x = MAX(MIN(xmouse, xslack),
-			    xine.x + sc->gap.left);
-			if (cc->geom.x > (xslack - sc->gap.right))
-				cc->geom.x -= sc->gap.right;
+			cc->geom.x = MAX(MIN(xmouse, xslack), xine.x);
 		} else {
-			cc->geom.x = xine.x + sc->gap.left;
-			cc->geom.w = xine.w - sc->gap.left;
+			cc->geom.x = xine.x;
+			cc->geom.w = xine.w;
 		}
 		if (yslack >= xine.y) {
-			cc->geom.y = MAX(MIN(ymouse, yslack),
-			    xine.y + sc->gap.top);
-			if (cc->geom.y > (yslack - sc->gap.bottom))
-				cc->geom.y -= sc->gap.bottom;
+			cc->geom.y = MAX(MIN(ymouse, yslack), xine.y);
 		} else {
-			cc->geom.y = xine.y + sc->gap.top;
-			cc->geom.h = xine.h - sc->gap.top;
+			cc->geom.y = xine.y;
+			cc->geom.h = xine.h;
 		}
 	}
 }