2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
13 update_client_name(Client *c)
21 XGetTextProperty(dpy, c->win, &name, net_atom[NetWMName]);
23 XGetWMName(dpy, c->win, &name);
26 if(name.encoding == XA_STRING)
27 strncpy(c->name, (char *)name.value, sizeof(c->name));
29 if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
32 strncpy(c->name, *list, sizeof(c->name));
33 XFreeStringList(list);
40 create_client(Window w, XWindowAttributes *wa)
43 XSetWindowAttributes twa;
46 c = emallocz(sizeof(Client));
48 c->r[RFloat].x = wa->x;
49 c->r[RFloat].y = wa->y;
50 c->r[RFloat].width = wa->width;
51 c->r[RFloat].height = wa->height;
52 c->border = wa->border_width;
53 XSetWindowBorderWidth(dpy, c->win, 0);
54 c->proto = win_proto(c->win);
55 XGetTransientForHint(dpy, c->win, &c->trans);
56 if(!XGetWMNormalHints(dpy, c->win, &c->size, &msize) || !c->size.flags)
57 c->size.flags = PSize;
59 (c->size.flags & PMinSize && c->size.flags & PMaxSize
60 && c->size.min_width == c->size.max_width
61 && c->size.min_height == c->size.max_height);
62 XAddToSaveSet(dpy, c->win);
63 update_client_name(c);
64 twa.override_redirect = 1;
65 twa.background_pixmap = ParentRelative;
66 twa.event_mask = ExposureMask;
68 c->title = XCreateWindow(dpy, root, c->r[RFloat].x, c->r[RFloat].y,
69 c->r[RFloat].width, barrect.height, 0,
70 DefaultDepth(dpy, screen), CopyFromParent,
71 DefaultVisual(dpy, screen),
72 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
76 for(t=&client, i=0; *t; t=&(*t)->next, i++);
77 c->next = *t; /* *t == nil */
86 XMapRaised(dpy, c->win);
87 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);