- Client *c, **l;
- XSetWindowAttributes twa;
- Window trans;
-
- c = emallocz(sizeof(Client));
- c->win = w;
- c->tx = c->x = wa->x;
- c->ty = c->y = wa->y;
- if(c->y < bh)
- c->ty = c->y += bh;
- c->tw = c->w = wa->width;
- c->h = wa->height;
- c->th = bh;
- c->border = 1;
- c->proto = win_proto(c->win);
- update_size(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->tx, c->ty, c->tw, c->th,
- 0, DefaultDepth(dpy, screen), CopyFromParent,
- DefaultVisual(dpy, screen),
- CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
-
- update_name(c);
- init_tags(c);
-
- for(l = &clients; *l; l = &(*l)->next);
- c->next = *l; /* *l == nil */
- *l = c;
-
- XMapRaised(dpy, c->win);
- XMapRaised(dpy, c->title);
- 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->floating)
- c->floating = trans
- || ((c->maxw == c->minw) && (c->maxh == c->minh));