mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
struct XftFont already has height which we can use directly instead of
calculating ourselves, so do so. ok oga@
This commit is contained in:
parent
f6fcd0eb5d
commit
c2a8363dd9
1
calmwm.h
1
calmwm.h
@ -207,7 +207,6 @@ struct screen_ctx {
|
|||||||
XftColor xftcolor;
|
XftColor xftcolor;
|
||||||
XftDraw *xftdraw;
|
XftDraw *xftdraw;
|
||||||
XftFont *font;
|
XftFont *font;
|
||||||
u_int fontheight;
|
|
||||||
int xinerama_no;
|
int xinerama_no;
|
||||||
XineramaScreenInfo *xinerama;
|
XineramaScreenInfo *xinerama;
|
||||||
#define CALMWM_NGROUPS 9
|
#define CALMWM_NGROUPS 9
|
||||||
|
1
conf.c
1
conf.c
@ -70,7 +70,6 @@ void
|
|||||||
conf_font(struct conf *c, struct screen_ctx *sc)
|
conf_font(struct conf *c, struct screen_ctx *sc)
|
||||||
{
|
{
|
||||||
sc->font = font_make(sc, c->DefaultFontName);
|
sc->font = font_make(sc, c->DefaultFontName);
|
||||||
sc->fontheight = font_ascent(sc) + font_descent(sc) + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
2
font.c
2
font.c
@ -45,7 +45,7 @@ font_descent(struct screen_ctx *sc)
|
|||||||
u_int
|
u_int
|
||||||
font_height(struct screen_ctx *sc)
|
font_height(struct screen_ctx *sc)
|
||||||
{
|
{
|
||||||
return (sc->fontheight);
|
return (sc->font->height + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -55,7 +55,7 @@ mousefunc_sweep_draw(struct client_ctx *cc)
|
|||||||
{
|
{
|
||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
char asize[10]; /* fits "nnnnxnnnn\0" */
|
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",
|
snprintf(asize, sizeof(asize), "%dx%d",
|
||||||
(cc->geom.width - cc->geom.basew) / cc->geom.incw,
|
(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_size = font_width(sc, asize, strlen(asize)) + 4;
|
||||||
width_name = font_width(sc, cc->name, strlen(cc->name)) + 4;
|
width_name = font_width(sc, cc->name, strlen(cc->name)) + 4;
|
||||||
width = MAX(width_size, width_name);
|
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,
|
XMoveResizeWindow(X_Dpy, sc->menuwin, cc->geom.x, cc->geom.y,
|
||||||
width, height * 2);
|
width, font_height(sc) * 2);
|
||||||
XMapWindow(X_Dpy, sc->menuwin);
|
XMapWindow(X_Dpy, sc->menuwin);
|
||||||
XReparentWindow(X_Dpy, sc->menuwin, cc->win, 0, 0);
|
XReparentWindow(X_Dpy, sc->menuwin, cc->win, 0, 0);
|
||||||
XClearWindow(X_Dpy, sc->menuwin);
|
XClearWindow(X_Dpy, sc->menuwin);
|
||||||
font_draw(sc, cc->name, strlen(cc->name), sc->menuwin,
|
font_draw(sc, cc->name, strlen(cc->name), sc->menuwin,
|
||||||
2, font_ascent(sc) + 1);
|
2, font_ascent(sc) + 1);
|
||||||
font_draw(sc, asize, strlen(asize), sc->menuwin,
|
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
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user