+ *c->x += dx;
+ *c->y += dy;
+}
+
+void
+higher(Client *c)
+{
+ XRaiseWindow(dpy, c->win);
+ XRaiseWindow(dpy, c->title);
+}
+
+void
+killclient(Arg *arg)
+{
+ if(!sel)
+ return;
+ if(sel->proto & WM_PROTOCOL_DELWIN)
+ sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]);
+ else
+ XKillClient(dpy, sel->win);
+}
+
+void
+lower(Client *c)
+{
+ XLowerWindow(dpy, c->title);
+ XLowerWindow(dpy, c->win);
+}
+
+void
+manage(Window w, XWindowAttributes *wa)
+{
+ Client *c;
+ XSetWindowAttributes twa;
+ Window trans;
+
+ c = emallocz(sizeof(Client));
+ c->win = w;
+ c->bx = c->fx = c->tx = wa->x;
+ c->by = c->fy = c->ty = wa->y;
+ if(c->fy < bh)
+ c->by = c->fy = c->ty += bh;
+ c->bw = c->fw = c->tw = wa->width;
+ c->fh = c->th = wa->height;
+ c->bh = bh;
+ c->border = 1;
+ c->proto = getproto(c->win);
+ setsize(c);
+ XSelectInput(dpy, c->win,
+ StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
+ XGetTransientForHint(dpy, c->win, &trans);
+ twa.override_redirect = 1;
+ twa.background_pixmap = ParentRelative;
+ twa.event_mask = ExposureMask;
+
+ c->title = XCreateWindow(dpy, root, c->bx, c->by, c->bw, c->bh,
+ 0, DefaultDepth(dpy, screen), CopyFromParent,
+ DefaultVisual(dpy, screen),
+ CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
+
+ settags(c);
+
+ c->next = clients;
+ clients = c;
+
+ XGrabButton(dpy, Button1, ControlMask, c->win, False, ButtonPressMask,
+ GrabModeAsync, GrabModeSync, None, None);
+ XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask,
+ GrabModeAsync, GrabModeSync, None, None);
+ XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask,
+ GrabModeAsync, GrabModeSync, None, None);
+ XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask,
+ GrabModeAsync, GrabModeSync, None, None);
+
+ if(!c->isfloat)
+ c->isfloat = trans
+ || ((c->maxw == c->minw) && (c->maxh == c->minh));
+
+ setgeom(c);
+ settitle(c);
+
+ arrange(NULL);
+
+ /* mapping the window now prevents flicker */
+ if(c->tags[tsel]) {
+ XMapRaised(dpy, c->win);
+ XMapRaised(dpy, c->title);
+ focus(c);
+ }
+ else {
+ ban(c);
+ XMapRaised(dpy, c->win);
+ XMapRaised(dpy, c->title);
+ XSync(dpy, False);
+ }