diff options
author | okan | 2016-12-06 21:00:13 +0000 |
---|---|---|
committer | okan | 2016-12-06 21:00:13 +0000 |
commit | 844994d9afb36549a0b78200fd421fbbde009431 (patch) | |
tree | 900f75b29368984d685b4424f7a17ac5488ad5d9 /client.c | |
parent | 6ad762d2ea741345ba11aa9beb59840bad1d2c98 (diff) | |
download | cwm-844994d9afb36549a0b78200fd421fbbde009431.tar.gz |
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.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: client.c,v 1.230 2016/10/18 17:03:30 okan Exp $ + * $OpenBSD: client.c,v 1.231 2016/12/06 21:00:13 okan Exp $ */ #include <sys/types.h> @@ -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 |