removed some unused code
This commit is contained in:
parent
ec52f00edf
commit
c2032b9cc6
40
x.c
40
x.c
@ -371,44 +371,6 @@ DC *initdc(void)
|
|||||||
return dc;
|
return dc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initfont(DC * dc, const char *fontstr)
|
|
||||||
{
|
|
||||||
char *def, **missing, **names;
|
|
||||||
int i, n;
|
|
||||||
XFontStruct **xfonts;
|
|
||||||
|
|
||||||
missing = NULL;
|
|
||||||
if ((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) {
|
|
||||||
dc->font.ascent = dc->font.xfont->ascent;
|
|
||||||
dc->font.descent = dc->font.xfont->descent;
|
|
||||||
dc->font.width = dc->font.xfont->max_bounds.width;
|
|
||||||
} else
|
|
||||||
if ((dc->font.set =
|
|
||||||
XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
|
|
||||||
n = XFontsOfFontSet(dc->font.set, &xfonts, &names);
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
dc->font.ascent =
|
|
||||||
MAX(dc->font.ascent, xfonts[i]->ascent);
|
|
||||||
dc->font.descent =
|
|
||||||
MAX(dc->font.descent, xfonts[i]->descent);
|
|
||||||
dc->font.width =
|
|
||||||
MAX(dc->font.width, xfonts[i]->max_bounds.width);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
if ((dc->font.xft_font =
|
|
||||||
XftFontOpenName(dc->dpy, DefaultScreen(dc->dpy), fontstr))) {
|
|
||||||
dc->font.ascent = dc->font.xft_font->ascent;
|
|
||||||
dc->font.descent = dc->font.xft_font->descent;
|
|
||||||
dc->font.width = dc->font.xft_font->max_advance_width;
|
|
||||||
} else {
|
|
||||||
eprintf("cannot load font '%s'\n", fontstr);
|
|
||||||
}
|
|
||||||
if (missing)
|
|
||||||
XFreeStringList(missing);
|
|
||||||
dc->font.height = dc->font.ascent + dc->font.descent;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setopacity(DC * dc, Window win, unsigned long opacity)
|
void setopacity(DC * dc, Window win, unsigned long opacity)
|
||||||
{
|
{
|
||||||
Atom _NET_WM_WINDOW_OPACITY =
|
Atom _NET_WM_WINDOW_OPACITY =
|
||||||
@ -684,8 +646,6 @@ void x_setup(void)
|
|||||||
/* initialize xctx.dc, font, keyboard, colors */
|
/* initialize xctx.dc, font, keyboard, colors */
|
||||||
xctx.dc = initdc();
|
xctx.dc = initdc();
|
||||||
|
|
||||||
initfont(xctx.dc, settings.font);
|
|
||||||
|
|
||||||
x_shortcut_init(&settings.close_ks);
|
x_shortcut_init(&settings.close_ks);
|
||||||
x_shortcut_init(&settings.close_all_ks);
|
x_shortcut_init(&settings.close_all_ks);
|
||||||
x_shortcut_init(&settings.history_ks);
|
x_shortcut_init(&settings.history_ks);
|
||||||
|
9
x.h
9
x.h
@ -119,22 +119,13 @@ typedef struct _xctx {
|
|||||||
|
|
||||||
extern xctx_t xctx;
|
extern xctx_t xctx;
|
||||||
|
|
||||||
void drawrect(DC * dc, int x, int y, unsigned int w, unsigned int h, bool fill,
|
|
||||||
unsigned long color);
|
|
||||||
void drawtext(DC * dc, const char *text, ColorSet * col);
|
|
||||||
void drawtextn(DC * dc, const char *text, size_t n, ColorSet * col);
|
|
||||||
void freecol(DC * dc, ColorSet * col);
|
void freecol(DC * dc, ColorSet * col);
|
||||||
void eprintf(const char *fmt, ...);
|
void eprintf(const char *fmt, ...);
|
||||||
void freedc(DC * dc);
|
void freedc(DC * dc);
|
||||||
unsigned long getcolor(DC * dc, const char *colstr);
|
unsigned long getcolor(DC * dc, const char *colstr);
|
||||||
ColorSet *initcolor(DC * dc, const char *foreground, const char *background);
|
ColorSet *initcolor(DC * dc, const char *foreground, const char *background);
|
||||||
DC *initdc(void);
|
DC *initdc(void);
|
||||||
void initfont(DC * dc, const char *fontstr);
|
|
||||||
void setopacity(DC * dc, Window win, unsigned long opacity);
|
void setopacity(DC * dc, Window win, unsigned long opacity);
|
||||||
void mapdc(DC * dc, Window win, unsigned int w, unsigned int h);
|
|
||||||
void resizedc(DC * dc, unsigned int w, unsigned int h);
|
|
||||||
int textnw(DC * dc, const char *text, size_t len);
|
|
||||||
int textw(DC * dc, const char *text);
|
|
||||||
|
|
||||||
/* window */
|
/* window */
|
||||||
void x_win_draw(void);
|
void x_win_draw(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user