summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2011-06-24 05:45:57 +0000
committerokan <okan>2011-06-24 05:45:57 +0000
commitc2a8363dd9868776c12bcdf172b7a02188621c90 (patch)
treea16d1496fdaa5cd2aed2c097c3e4a41980e8cd0b
parentf6fcd0eb5d2f48b82f52b65fa343a83c74a8f55f (diff)
downloadcwm-c2a8363dd9868776c12bcdf172b7a02188621c90.tar.gz
cwm-c2a8363dd9868776c12bcdf172b7a02188621c90.tar.xz
cwm-c2a8363dd9868776c12bcdf172b7a02188621c90.zip
struct XftFont already has height which we can use directly instead of
calculating ourselves, so do so.

ok oga@
-rw-r--r--calmwm.h1
-rw-r--r--conf.c1
-rw-r--r--font.c2
-rw-r--r--mousefunc.c7
4 files changed, 4 insertions, 7 deletions
diff --git a/calmwm.h b/calmwm.h
index a99c334..f5f0156 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -207,7 +207,6 @@ struct screen_ctx {
 	XftColor		 xftcolor;
 	XftDraw			*xftdraw;
 	XftFont			*font;
-	u_int			 fontheight;
 	int			 xinerama_no;
 	XineramaScreenInfo	*xinerama;
 #define CALMWM_NGROUPS		 9
diff --git a/conf.c b/conf.c
index 1bd1788..06352ab 100644
--- a/conf.c
+++ b/conf.c
@@ -70,7 +70,6 @@ void
 conf_font(struct conf *c, struct screen_ctx *sc)
 {
 	sc->font = font_make(sc, c->DefaultFontName);
-	sc->fontheight = font_ascent(sc) + font_descent(sc) + 1;
 }
 
 void
diff --git a/font.c b/font.c
index 47c7348..6ab2b51 100644
--- a/font.c
+++ b/font.c
@@ -45,7 +45,7 @@ font_descent(struct screen_ctx *sc)
 u_int
 font_height(struct screen_ctx *sc)
 {
-	return (sc->fontheight);
+	return (sc->font->height + 1);
 }
 
 void
diff --git a/mousefunc.c b/mousefunc.c
index 04c1931..9037b6a 100644
--- a/mousefunc.c
+++ b/mousefunc.c
@@ -55,7 +55,7 @@ mousefunc_sweep_draw(struct client_ctx *cc)
 {
 	struct screen_ctx	*sc = cc->sc;
 	char			 asize[10]; /* fits "nnnnxnnnn\0" */
-	int			 width, height, width_size, width_name;
+	int			 width, width_size, width_name;
 
 	snprintf(asize, sizeof(asize), "%dx%d",
 	    (cc->geom.width - cc->geom.basew) / cc->geom.incw,
@@ -63,17 +63,16 @@ mousefunc_sweep_draw(struct client_ctx *cc)
 	width_size = font_width(sc, asize, strlen(asize)) + 4;
 	width_name = font_width(sc, cc->name, strlen(cc->name)) + 4;
 	width = MAX(width_size, width_name);
-	height = font_ascent(sc) + font_descent(sc) + 1;
 
 	XMoveResizeWindow(X_Dpy, sc->menuwin, cc->geom.x, cc->geom.y,
-	    width, height * 2);
+	    width, font_height(sc) * 2);
 	XMapWindow(X_Dpy, sc->menuwin);
 	XReparentWindow(X_Dpy, sc->menuwin, cc->win, 0, 0);
 	XClearWindow(X_Dpy, sc->menuwin);
 	font_draw(sc, cc->name, strlen(cc->name), sc->menuwin,
 	    2, font_ascent(sc) + 1);
 	font_draw(sc, asize, strlen(asize), sc->menuwin,
-	    width / 2 - width_size / 2, height + font_ascent(sc) + 1);
+	    width / 2 - width_size / 2, font_height(sc) + font_ascent(sc) + 1);
 }
 
 void