- for(i = 0; i < mcount; i++) {
- /* init geometry */
- m = &monitors[i];
-
- if (mcount != 1 && isxinerama) {
- m->sx = info[i].x_org;
- m->sy = info[i].y_org;
- m->sw = info[i].width;
- m->sh = info[i].height;
- fprintf(stderr, "monitor[%d]: %d,%d,%d,%d\n", i, m->sx, m->sy, m->sw, m->sh);
- }
- else {
- m->sx = 0;
- m->sy = 0;
- m->sw = DisplayWidth(dpy, screen);
- m->sh = DisplayHeight(dpy, screen);
- }
-
- m->seltags = emallocz(sizeof initags);
- m->prevtags = emallocz(sizeof initags);
-
- memcpy(m->seltags, initags, sizeof initags);
- memcpy(m->prevtags, initags, sizeof initags);
-
- /* init layouts */
- m->mwfact = MWFACT;
- m->layout = &layouts[0];
-
- // 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, root, m->sx, m->sy, m->sw, bh, 0,
- DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
- XDefineCursor(dpy, m->barwin, cursor[CurNormal]);
- updatebarpos(m);
- XMapRaised(dpy, m->barwin);
- strcpy(stext, "dwm-"VERSION);
-
- /* EWMH support per monitor */
- XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
- PropModeReplace, (unsigned char *) netatom, NetLast);
-
- /* select for events */
- wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
- | EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
- XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
- XSelectInput(dpy, root, wa.event_mask);