+ m->seltags = emallocz(sizeof initags);
+ m->prevtags = emallocz(sizeof initags);
+
+ memcpy(m->seltags, initags, sizeof initags);
+ memcpy(m->prevtags, initags, sizeof initags);
+
+ /* init appearance */
+ m->dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR, i);
+ m->dc.norm[ColBG] = getcolor(NORMBGCOLOR, i);
+ m->dc.norm[ColFG] = getcolor(NORMFGCOLOR, i);
+ m->dc.sel[ColBorder] = getcolor(SELBORDERCOLOR, i);
+ m->dc.sel[ColBG] = getcolor(SELBGCOLOR, i);
+ m->dc.sel[ColFG] = getcolor(SELFGCOLOR, i);
+ initfont(m, FONT);
+ m->dc.h = bh = m->dc.font.height + 2;
+
+ /* init layouts */
+ m->mwfact = MWFACT;
+ m->layout = &layouts[0];
+ for(blw = k = 0; k < LENGTH(layouts); k++) {
+ j = textw(m, layouts[k].symbol);
+ if(j > blw)
+ blw = j;
+ }
+
+ // TODO: bpos per screen?
+ bpos = BARPOS;
+ wa.override_redirect = 1;
+ wa.background_pixmap = ParentRelative;
+ wa.event_mask = ButtonPressMask | ExposureMask;
+
+ /* init bars */
+ m->barwin = XCreateWindow(dpy, m->root, m->sx, m->sy, m->sw, bh, 0,
+ DefaultDepth(dpy, m->screen), CopyFromParent, DefaultVisual(dpy, m->screen),
+ CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
+ XDefineCursor(dpy, m->barwin, cursor[CurNormal]);
+ updatebarpos(m);
+ XMapRaised(dpy, m->barwin);
+ strcpy(stext, "dwm-"VERSION);
+ m->dc.drawable = XCreatePixmap(dpy, m->root, m->sw, bh, DefaultDepth(dpy, m->screen));
+ m->dc.gc = XCreateGC(dpy, m->root, 0, 0);
+ XSetLineAttributes(dpy, m->dc.gc, 1, LineSolid, CapButt, JoinMiter);
+ if(!m->dc.font.set)
+ XSetFont(dpy, m->dc.gc, m->dc.font.xfont->fid);
+
+ /* EWMH support per monitor */
+ XChangeProperty(dpy, m->root, netatom[NetSupported], XA_ATOM, 32,
+ PropModeReplace, (unsigned char *) netatom, NetLast);
+
+ /* select for events */
+ wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
+ | EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
+ XChangeWindowAttributes(dpy, m->root, CWEventMask | CWCursor, &wa);
+ XSelectInput(dpy, m->root, wa.event_mask);
+ }