-
- /* 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;
- layout = &layouts[0];
- for(blw = i = 0; i < LENGTH(layouts); 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);
-
- /* EWMH properties */
- XChangeProperty(dpy, barwin, netatom[NetWMCheck], XA_WINDOW, 32,
- PropModeReplace, (unsigned char *) &barwin, 1);
- /* HACK: dwm identifies itself as LookingGlass to workaround the XToolkit bug of Sun JDK */
- XChangeProperty(dpy, barwin, netatom[NetWMName], utf8string, 8,
- PropModeReplace, (unsigned char *) "LG3D", 4);
- XChangeProperty(dpy, root, netatom[NetWMCheck], XA_WINDOW, 32,
- PropModeReplace, (unsigned char *) &barwin, 1);
- XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
- PropModeReplace, (unsigned char *) netatom, NetLast);