- for(ntags = 0; tags[ntags]; ntags++);
- seltags = emallocz(sizeof(Bool) * ntags);
- seltags[0] = True;
-
- /* init appearance */
- dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
- dc.norm[ColBG] = getcolor(NORMBGCOLOR);
- dc.norm[ColFG] = getcolor(NORMFGCOLOR);
- dc.sel[ColBorder] = getcolor(SELBORDERCOLOR);
- dc.sel[ColBG] = getcolor(SELBGCOLOR);
- dc.sel[ColFG] = getcolor(SELFGCOLOR);
- initfont(FONT);
- dc.h = bh = dc.font.height + 2;
-
- /* init layouts */
- mwfact = MWFACT;
- nlayouts = sizeof layouts / sizeof layouts[0];
- for(blw = i = 0; i < nlayouts; i++) {
- j = textw(layouts[i].symbol);
- if(j > blw)
- blw = j;
- }
-
- /* init bar */
- bpos = BARPOS;
- wa.override_redirect = 1;
- wa.background_pixmap = ParentRelative;
- wa.event_mask = ButtonPressMask | ExposureMask;
- barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0,
- DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
- XDefineCursor(dpy, barwin, cursor[CurNormal]);
- updatebarpos();
- XMapRaised(dpy, barwin);
- strcpy(stext, "dwm-"VERSION);
- dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
- dc.gc = XCreateGC(dpy, root, 0, 0);
- XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
- if(!dc.font.set)
- XSetFont(dpy, dc.gc, dc.font.xfont->fid);
-
- /* multihead support */
- selscreen = XQueryPointer(dpy, root, &w, &w, &d, &d, &d, &d, &mask);