- /* EWMH properties */
- XChangeProperty(dpy, barwin, netatom[NetWMCheck], XA_WINDOW, 32,
- PropModeReplace, (unsigned char *) &barwin, 1);
- /* HACK: dwm identifies itself as compiz to workaround the XToolkit bug of Sun JDK */
- XChangeProperty(dpy, barwin, netatom[NetWMName], utf8string, 8,
- PropModeReplace, (unsigned char *) "compiz", 7);
- 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);
+ if(info) {
+
+#if defined(AIM_XINERAMA)
+v->w = DisplayWidth(dpy, screen) / 2;
+v->x = (i == 0) ? 0 : v->w;
+v->y = 0;
+v->h = DisplayHeight(dpy, screen);
+#else
+ v->x = info[i].x_org;
+ v->y = info[i].y_org;
+ v->w = info[i].width;
+ v->h = info[i].height;
+#endif
+ }
+ else {
+ v->x = 0;
+ v->y = 0;
+ v->w = DisplayWidth(dpy, screen);
+ v->h = DisplayHeight(dpy, screen);
+ }
+
+ /* init layouts */
+ v->mwfact = MWFACT;
+ v->layout = &layouts[0];
+
+ // TODO: bpos per screen?
+ bpos = BARPOS;
+ wa.override_redirect = 1;
+ wa.background_pixmap = ParentRelative;
+ wa.event_mask = ButtonPressMask|ExposureMask;
+
+ /* init bars */
+ v->barwin = XCreateWindow(dpy, root, v->x, v->y, v->w, bh, 0,
+ DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
+ CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+ XDefineCursor(dpy, v->barwin, cursor[CurNormal]);
+ updatebarpos(v);
+ XMapRaised(dpy, v->barwin);
+ strcpy(stext, "dwm-"VERSION);
+
+ /* EWMH support per view */
+ 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);
+
+ drawbar(v);
+ }
+ if(info)
+ XFree(info);
+
+ selview = viewat();
+
+ /* grab keys */
+ grabkeys();