renamed setfont to initfont, getcolor to initcolor

This commit is contained in:
Anselm R. Garbe 2007-02-20 13:56:21 +01:00
parent 138b7fbd05
commit d180ba418c

58
main.c
View file

@ -62,7 +62,7 @@ cleanup(void) {
} }
static unsigned long static unsigned long
getcolor(const char *colstr) { initcolor(const char *colstr) {
Colormap cmap = DefaultColormap(dpy, screen); Colormap cmap = DefaultColormap(dpy, screen);
XColor color; XColor color;
@ -72,27 +72,7 @@ getcolor(const char *colstr) {
} }
static void static void
scan(void) { initfont(const char *fontstr) {
unsigned int i, num;
Window *wins, d1, d2;
XWindowAttributes wa;
wins = NULL;
if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
for(i = 0; i < num; i++) {
if(!XGetWindowAttributes(dpy, wins[i], &wa)
|| wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
continue;
if(wa.map_state == IsViewable)
manage(wins[i], &wa);
}
}
if(wins)
XFree(wins);
}
static void
setfont(const char *fontstr) {
char *def, **missing; char *def, **missing;
int i, n; int i, n;
@ -132,6 +112,26 @@ setfont(const char *fontstr) {
dc.font.height = dc.font.ascent + dc.font.descent; dc.font.height = dc.font.ascent + dc.font.descent;
} }
static void
scan(void) {
unsigned int i, num;
Window *wins, d1, d2;
XWindowAttributes wa;
wins = NULL;
if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
for(i = 0; i < num; i++) {
if(!XGetWindowAttributes(dpy, wins[i], &wa)
|| wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1))
continue;
if(wa.map_state == IsViewable)
manage(wins[i], &wa);
}
}
if(wins)
XFree(wins);
}
static void static void
setup(void) { setup(void) {
int i, j; int i, j;
@ -173,13 +173,13 @@ setup(void) {
seltag = emallocz(sizeof(Bool) * ntags); seltag = emallocz(sizeof(Bool) * ntags);
seltag[0] = True; seltag[0] = True;
/* style */ /* style */
dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR); dc.norm[ColBorder] = initcolor(NORMBORDERCOLOR);
dc.norm[ColBG] = getcolor(NORMBGCOLOR); dc.norm[ColBG] = initcolor(NORMBGCOLOR);
dc.norm[ColFG] = getcolor(NORMFGCOLOR); dc.norm[ColFG] = initcolor(NORMFGCOLOR);
dc.sel[ColBorder] = getcolor(SELBORDERCOLOR); dc.sel[ColBorder] = initcolor(SELBORDERCOLOR);
dc.sel[ColBG] = getcolor(SELBGCOLOR); dc.sel[ColBG] = initcolor(SELBGCOLOR);
dc.sel[ColFG] = getcolor(SELFGCOLOR); dc.sel[ColFG] = initcolor(SELFGCOLOR);
setfont(FONT); initfont(FONT);
/* geometry */ /* geometry */
sx = sy = 0; sx = sy = 0;
sw = DisplayWidth(dpy, screen); sw = DisplayWidth(dpy, screen);