- bpos = BARPOS;
- wa.override_redirect = 1;
- wa.background_pixmap = ParentRelative;
- wa.event_mask = ButtonPressMask | ExposureMask;
-
- /* init bars */
- monitors[i].barwin = XCreateWindow(dpy, root, monitors[i].sx, monitors[i].sy, monitors[i].sw, bh, 0,
- DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
- XDefineCursor(dpy, monitors[i].barwin, cursor[CurNormal]);
- updatebarpos(&monitors[i]);
- XMapRaised(dpy, monitors[i].barwin);
- strcpy(stext, "dwm-"VERSION);
- monitors[i].dc.drawable = XCreatePixmap(dpy, root, monitors[i].sw, bh, DefaultDepth(dpy, screen));
- g = XCreateGC(dpy, root, 0, 0);
- monitors[i].dc.gc = XCreateGC(dpy, root, 0, 0);
- XSetLineAttributes(dpy, monitors[i].dc.gc, 1, LineSolid, CapButt, JoinMiter);
- if(!monitors[i].dc.font.set)
- XSetFont(dpy, monitors[i].dc.gc, monitors[i].dc.font.xfont->fid);
- }
+ /* select for events */
+ wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
+ |EnterWindowMask|LeaveWindowMask|StructureNotifyMask;
+ XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
+ XSelectInput(dpy, root, wa.event_mask);
+
+
+ /* grab keys */
+ grabkeys();