mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
cvsimport
This commit is contained in:
14
LICENSE
14
LICENSE
@@ -1,14 +0,0 @@
|
|||||||
Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
|
|
||||||
Copyright (c) 2004 Andy Adamson <dros@monkey.org>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
7
calmwm.h
7
calmwm.h
@@ -458,9 +458,9 @@ int font_descent(struct screen_ctx *);
|
|||||||
void font_draw(struct screen_ctx *, const char *, int,
|
void font_draw(struct screen_ctx *, const char *, int,
|
||||||
Drawable, int, int);
|
Drawable, int, int);
|
||||||
u_int font_height(struct screen_ctx *);
|
u_int font_height(struct screen_ctx *);
|
||||||
void font_init(struct screen_ctx *, const char *);
|
void font_init(struct screen_ctx *, const char *,
|
||||||
|
const char *);
|
||||||
int font_width(struct screen_ctx *, const char *, int);
|
int font_width(struct screen_ctx *, const char *, int);
|
||||||
XftFont *font_make(struct screen_ctx *, const char *);
|
|
||||||
|
|
||||||
void xev_loop(void);
|
void xev_loop(void);
|
||||||
|
|
||||||
@@ -504,6 +504,9 @@ void u_spawn(char *);
|
|||||||
void *xcalloc(size_t, size_t);
|
void *xcalloc(size_t, size_t);
|
||||||
void *xmalloc(size_t);
|
void *xmalloc(size_t);
|
||||||
char *xstrdup(const char *);
|
char *xstrdup(const char *);
|
||||||
|
int xasprintf(char **, const char *, ...)
|
||||||
|
__attribute__((__format__ (printf, 2, 3)))
|
||||||
|
__attribute__((__nonnull__ (2)));
|
||||||
|
|
||||||
/* Externs */
|
/* Externs */
|
||||||
extern Display *X_Dpy;
|
extern Display *X_Dpy;
|
||||||
|
|||||||
3
conf.c
3
conf.c
@@ -62,8 +62,7 @@ conf_gap(struct conf *c, struct screen_ctx *sc)
|
|||||||
void
|
void
|
||||||
conf_font(struct conf *c, struct screen_ctx *sc)
|
conf_font(struct conf *c, struct screen_ctx *sc)
|
||||||
{
|
{
|
||||||
font_init(sc, c->color[CWM_COLOR_FONT].name);
|
font_init(sc, c->font, c->color[CWM_COLOR_FONT].name);
|
||||||
sc->font = font_make(sc, c->font);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct color color_binds[] = {
|
static struct color color_binds[] = {
|
||||||
|
|||||||
24
font.c
24
font.c
@@ -49,7 +49,7 @@ font_height(struct screen_ctx *sc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
font_init(struct screen_ctx *sc, const char *color)
|
font_init(struct screen_ctx *sc, const char *name, const char *color)
|
||||||
{
|
{
|
||||||
sc->xftdraw = XftDrawCreate(X_Dpy, sc->rootwin,
|
sc->xftdraw = XftDrawCreate(X_Dpy, sc->rootwin,
|
||||||
DefaultVisual(X_Dpy, sc->which), DefaultColormap(X_Dpy, sc->which));
|
DefaultVisual(X_Dpy, sc->which), DefaultColormap(X_Dpy, sc->which));
|
||||||
@@ -59,6 +59,10 @@ font_init(struct screen_ctx *sc, const char *color)
|
|||||||
if (!XftColorAllocName(X_Dpy, DefaultVisual(X_Dpy, sc->which),
|
if (!XftColorAllocName(X_Dpy, DefaultVisual(X_Dpy, sc->which),
|
||||||
DefaultColormap(X_Dpy, sc->which), color, &sc->xftcolor))
|
DefaultColormap(X_Dpy, sc->which), color, &sc->xftcolor))
|
||||||
errx(1, "XftColorAllocName");
|
errx(1, "XftColorAllocName");
|
||||||
|
|
||||||
|
sc->font = XftFontOpenName(X_Dpy, sc->which, name);
|
||||||
|
if (sc->font == NULL)
|
||||||
|
errx(1, "XftFontOpenName");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -80,21 +84,3 @@ font_draw(struct screen_ctx *sc, const char *text, int len,
|
|||||||
XftDrawStringUtf8(sc->xftdraw, &sc->xftcolor, sc->font, x, y,
|
XftDrawStringUtf8(sc->xftdraw, &sc->xftcolor, sc->font, x, y,
|
||||||
(const FcChar8*)text, len);
|
(const FcChar8*)text, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
XftFont *
|
|
||||||
font_make(struct screen_ctx *sc, const char *name)
|
|
||||||
{
|
|
||||||
XftFont *fn = NULL;
|
|
||||||
FcPattern *pat, *patx;
|
|
||||||
XftResult res;
|
|
||||||
|
|
||||||
if ((pat = FcNameParse((const FcChar8*)name)) == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
if ((patx = XftFontMatch(X_Dpy, sc->which, pat, &res)) != NULL)
|
|
||||||
fn = XftFontOpenPattern(X_Dpy, patx);
|
|
||||||
|
|
||||||
FcPatternDestroy(pat);
|
|
||||||
|
|
||||||
return (fn);
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user