summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorokan <okan>2016-12-06 21:00:13 +0000
committerokan <okan>2016-12-06 21:00:13 +0000
commit74092f78aac0dbb9e86621f620d49341f7387053 (patch)
tree40873f6ec3866be46016a64ef3fd5af92499e341 /client.c
parentcf4c1879e52449eb6b921c876e79fc854d079434 (diff)
downloadcwm-74092f78aac0dbb9e86621f620d49341f7387053.tar.gz
cwm-74092f78aac0dbb9e86621f620d49341f7387053.tar.xz
cwm-74092f78aac0dbb9e86621f620d49341f7387053.zip
Set dim.{x,y} during client_init and update on resize, instead of
(re)calculating only when applying hints.
Diffstat (limited to 'client.c')
-rw-r--r--client.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/client.c b/client.c
index 58d7f88..b393fb8 100644
--- a/client.c
+++ b/client.c
@@ -91,6 +91,8 @@ client_init(Window win, struct screen_ctx *sc, int active)
 	cc->geom.y = wattr.y;
 	cc->geom.w = wattr.width;
 	cc->geom.h = wattr.height;
+	cc->dim.w = (cc->geom.w - cc->hint.basew) / cc->hint.incw;
+	cc->dim.h = (cc->geom.h - cc->hint.baseh) / cc->hint.inch;
 	cc->ptr.x = cc->geom.w / 2;
 	cc->ptr.y = cc->geom.h / 2;
 
@@ -424,6 +426,8 @@ client_resize(struct client_ctx *cc, int reset)
 
 	XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x,
 	    cc->geom.y, cc->geom.w, cc->geom.h);
+	cc->dim.w = (cc->geom.w - cc->hint.basew) / cc->hint.incw;
+	cc->dim.h = (cc->geom.h - cc->hint.baseh) / cc->hint.inch;
 	client_config(cc);
 }
 
@@ -877,9 +881,6 @@ client_applysizehints(struct client_ctx *cc)
 		cc->geom.w = MIN(cc->geom.w, cc->hint.maxw);
 	if (cc->hint.maxh)
 		cc->geom.h = MIN(cc->geom.h, cc->hint.maxh);
-
-	cc->dim.w = (cc->geom.w - cc->hint.basew) / cc->hint.incw;
-	cc->dim.h = (cc->geom.h - cc->hint.baseh) / cc->hint.inch;
 }
 
 static void