- /* init atoms */
- wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
- wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
- netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
- netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
- XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
- PropModeReplace, (unsigned char *) netatom, NetLast);
-
- /* init cursors */
- cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
- cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
- cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
-
- grabkeys();
- initrregs();
-
- for(ntags = 0; tags[ntags]; ntags++);
- tsel = emallocz(sizeof(Bool) * ntags);
- tsel[DEFTAG] = True;
-
- /* style */
- dc.bg = getcolor(BGCOLOR);
- dc.fg = getcolor(FGCOLOR);
- dc.border = getcolor(BORDERCOLOR);
- setfont(FONT);
-
- sx = sy = 0;
- sw = DisplayWidth(dpy, screen);
- sh = DisplayHeight(dpy, screen);
- mw = (sw * MASTERW) / 100;
-
- wa.override_redirect = 1;
- wa.background_pixmap = ParentRelative;
- wa.event_mask = ButtonPressMask | ExposureMask;
-
- bx = by = 0;
- bw = sw;
- dc.h = bh = dc.font.height + 4;
- barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen),
- CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
- XDefineCursor(dpy, barwin, cursor[CurNormal]);
- XMapRaised(dpy, barwin);
-
- dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
- dc.gc = XCreateGC(dpy, root, 0, 0);
-
- strcpy(stext, "dwm-"VERSION);