From 9180bb1a06abc01e8b0eaa0ae6b8c934988a8f6e Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 8 Jun 2015 15:11:29 +0000 Subject: [PATCH] stash window dimensions --- calmwm.h | 4 ++++ client.c | 3 +++ mousefunc.c | 4 +--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/calmwm.h b/calmwm.h index 69b8a9d..b7d8a8a 100644 --- a/calmwm.h +++ b/calmwm.h @@ -169,6 +169,10 @@ struct client_ctx { int x; /* x position */ int y; /* y position */ } ptr; + struct { + int h; /* hieght */ + int w; /* width */ + } dim; #define CLIENT_HIDDEN 0x0001 #define CLIENT_IGNORE 0x0002 #define CLIENT_VMAXIMIZED 0x0004 diff --git a/client.c b/client.c index 811ee18..16eee3a 100644 --- a/client.c +++ b/client.c @@ -874,6 +874,9 @@ client_applysizehints(struct client_ctx *cc) cc->geom.w = MAX(cc->geom.w, 1); cc->geom.h = MAX(cc->geom.h, 1); + + 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 diff --git a/mousefunc.c b/mousefunc.c index e06196f..718a577 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -53,9 +53,7 @@ mousefunc_sweep_draw(struct client_ctx *cc) struct screen_ctx *sc = cc->sc; char s[14]; /* fits " nnnn x nnnn \0" */ - (void)snprintf(s, sizeof(s), " %4d x %-4d ", - (cc->geom.w - cc->hint.basew) / cc->hint.incw, - (cc->geom.h - cc->hint.baseh) / cc->hint.inch); + (void)snprintf(s, sizeof(s), " %4d x %-4d ", cc->dim.w, cc->dim.h); XReparentWindow(X_Dpy, sc->menuwin, cc->win, 0, 0); XMoveResizeWindow(X_Dpy, sc->menuwin, 0, 0,