bar.c
changeset 989 5f7018237edb
parent 988 aea51354bbe6
equal deleted inserted replaced
988:aea51354bbe6 989:5f7018237edb
    67 	}
    67 	}
    68 	else {
    68 	else {
    69 		if(dc.font.xfont)
    69 		if(dc.font.xfont)
    70 			XFreeFont(dpy, dc.font.xfont);
    70 			XFreeFont(dpy, dc.font.xfont);
    71 		dc.font.xfont = NULL;
    71 		dc.font.xfont = NULL;
    72 		if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)))
    72 		if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))
       
    73 		|| !(dc.font.xfont = XLoadQueryFont(dpy, "fixed")))
    73 			eprint("error, cannot load font: '%s'\n", fontstr);
    74 			eprint("error, cannot load font: '%s'\n", fontstr);
    74 		dc.font.ascent = dc.font.xfont->ascent;
    75 		dc.font.ascent = dc.font.xfont->ascent;
    75 		dc.font.descent = dc.font.xfont->descent;
    76 		dc.font.descent = dc.font.xfont->descent;
    76 	}
    77 	}
    77 	dc.font.height = dc.font.ascent + dc.font.descent;
    78 	dc.font.height = dc.font.ascent + dc.font.descent;
   184 	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0);
   185 	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0);
   185 	XSync(dpy, False);
   186 	XSync(dpy, False);
   186 }
   187 }
   187 
   188 
   188 void
   189 void
   189 initbar(void) {
   190 initstyle(void) {
   190 	XSetWindowAttributes wa;
       
   191 
       
   192 	dc.norm[ColBorder] = initcolor(NORMBORDERCOLOR);
   191 	dc.norm[ColBorder] = initcolor(NORMBORDERCOLOR);
   193 	dc.norm[ColBG] = initcolor(NORMBGCOLOR);
   192 	dc.norm[ColBG] = initcolor(NORMBGCOLOR);
   194 	dc.norm[ColFG] = initcolor(NORMFGCOLOR);
   193 	dc.norm[ColFG] = initcolor(NORMFGCOLOR);
   195 	dc.sel[ColBorder] = initcolor(SELBORDERCOLOR);
   194 	dc.sel[ColBorder] = initcolor(SELBORDERCOLOR);
   196 	dc.sel[ColBG] = initcolor(SELBGCOLOR);
   195 	dc.sel[ColBG] = initcolor(SELBGCOLOR);
   197 	dc.sel[ColFG] = initcolor(SELFGCOLOR);
   196 	dc.sel[ColFG] = initcolor(SELFGCOLOR);
   198 	initfont(FONT);
   197 	initfont(FONT);
   199 	dc.h = bh = dc.font.height + 2;
   198 	dc.h = bh = dc.font.height + 2;
       
   199 }
       
   200 
       
   201 void
       
   202 initbar(void) {
       
   203 	XSetWindowAttributes wa;
       
   204 
   200 	wa.override_redirect = 1;
   205 	wa.override_redirect = 1;
   201 	wa.background_pixmap = ParentRelative;
   206 	wa.background_pixmap = ParentRelative;
   202 	wa.event_mask = ButtonPressMask | ExposureMask;
   207 	wa.event_mask = ButtonPressMask | ExposureMask;
   203 	barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0,
   208 	barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0,
   204 			DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
   209 			DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),