aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2011-06-24 05:45:57 +0000
committerokan2011-06-24 05:45:57 +0000
commit2de7aba86f0a58b402764864d7de4af200682895 (patch)
treebe328e3380de60a30704daad69934c3e1a2e5b39
parent042dd52d9a25ab335d4aad404694a0bef8b93ebd (diff)
downloadcwm-2de7aba86f0a58b402764864d7de4af200682895.tar.gz
struct XftFont already has height which we can use directly instead of
calculating ourselves, so do so. ok oga@
-rw-r--r--calmwm.h3
-rw-r--r--conf.c3
-rw-r--r--font.c4
-rw-r--r--mousefunc.c9
4 files changed, 8 insertions, 11 deletions
diff --git a/calmwm.h b/calmwm.h
index 381106d..a7abad3 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -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: calmwm.h,v 1.128 2011/06/24 05:40:09 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.129 2011/06/24 05:45:57 okan Exp $
*/
#ifndef _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 62943a6..c04dd0d 100644
--- a/conf.c
+++ b/conf.c
@@ -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: conf.c,v 1.81 2011/06/24 05:40:09 okan Exp $
+ * $OpenBSD: conf.c,v 1.82 2011/06/24 05:45:57 okan Exp $
*/
#include <sys/param.h>
@@ -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 63d315b..20075f9 100644
--- a/font.c
+++ b/font.c
@@ -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: font.c,v 1.14 2011/05/11 13:53:51 okan Exp $
+ * $OpenBSD: font.c,v 1.15 2011/06/24 05:45:57 okan Exp $
*/
#include <sys/param.h>
@@ -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 6b50de6..486a6f8 100644
--- a/mousefunc.c
+++ b/mousefunc.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: mousefunc.c,v 1.26 2011/05/13 12:53:19 okan Exp $
+ * $OpenBSD: mousefunc.c,v 1.27 2011/06/24 05:45:57 okan Exp $
*/
#include <sys/param.h>
@@ -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