26 static void |
26 static void |
27 resizetitle(Client *c) |
27 resizetitle(Client *c) |
28 { |
28 { |
29 int i; |
29 int i; |
30 |
30 |
31 c->tw = 0; |
31 c->tw = textw(c->name); |
32 for(i = 0; i < ntags; i++) |
|
33 if(c->tags[i]) |
|
34 c->tw += textw(tags[i]); |
|
35 c->tw += textw(c->name); |
|
36 if(c->tw > c->w) |
32 if(c->tw > c->w) |
37 c->tw = c->w + 2; |
33 c->tw = c->w + 2; |
38 c->tx = c->x + c->w - c->tw + 2; |
34 c->tx = c->x + c->w - c->tw + 2; |
39 c->ty = c->y; |
35 c->ty = c->y; |
40 if(isvisible(c)) |
36 if(isvisible(c)) |
41 XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th); |
37 XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); |
42 else |
38 else |
43 XMoveResizeWindow(dpy, c->title, c->tx + 2 * sw, c->ty, c->tw, c->th); |
39 XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); |
44 |
40 |
45 } |
41 } |
46 |
42 |
47 static void |
43 static void |
48 ungrabbutton(Client *c, unsigned int button, unsigned int modifier) |
44 ungrabbutton(Client *c, unsigned int button, unsigned int modifier) |
212 XGetTransientForHint(dpy, c->win, &trans); |
208 XGetTransientForHint(dpy, c->win, &trans); |
213 twa.override_redirect = 1; |
209 twa.override_redirect = 1; |
214 twa.background_pixmap = ParentRelative; |
210 twa.background_pixmap = ParentRelative; |
215 twa.event_mask = ExposureMask | EnterWindowMask; |
211 twa.event_mask = ExposureMask | EnterWindowMask; |
216 |
212 |
217 c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, |
213 c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, |
218 0, DefaultDepth(dpy, screen), CopyFromParent, |
214 0, DefaultDepth(dpy, screen), CopyFromParent, |
219 DefaultVisual(dpy, screen), |
215 DefaultVisual(dpy, screen), |
220 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); |
216 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); |
221 |
217 |
222 if(clients) |
218 if(clients) |
390 { |
386 { |
391 XGrabServer(dpy); |
387 XGrabServer(dpy); |
392 XSetErrorHandler(xerrordummy); |
388 XSetErrorHandler(xerrordummy); |
393 |
389 |
394 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
390 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
395 XDestroyWindow(dpy, c->title); |
391 XDestroyWindow(dpy, c->twin); |
396 |
392 |
397 if(c->prev) |
393 if(c->prev) |
398 c->prev->next = c->next; |
394 c->prev->next = c->next; |
399 if(c->next) |
395 if(c->next) |
400 c->next->prev = c->prev; |
396 c->next->prev = c->prev; |