fixed several other stuff, coming closer to something useful
896f08d7
5 file(s) · +23 −15
| 15 | 15 | if(stack) { |
|
| 16 | 16 | brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font); |
|
| 17 | 17 | swap((void **)&brush.fg, (void **)&brush.bg); |
|
| 18 | - | draw(dpy, &brush, False, stack->name); |
|
| 18 | + | draw(dpy, &brush, True, stack->name); |
|
| 19 | 19 | swap((void **)&brush.fg, (void **)&brush.bg); |
|
| 20 | 20 | brush.rect.x += brush.rect.width; |
|
| 21 | 21 | } |
| 104 | 104 | ||
| 105 | 105 | c = emallocz(sizeof(Client)); |
|
| 106 | 106 | c->win = w; |
|
| 107 | - | c->x = wa->x; |
|
| 108 | - | c->y = wa->y; |
|
| 109 | - | c->w = wa->width; |
|
| 107 | + | c->tx = c->x = wa->x; |
|
| 108 | + | c->ty = c->y = wa->y; |
|
| 109 | + | c->tw = c->w = wa->width; |
|
| 110 | 110 | c->h = wa->height; |
|
| 111 | + | c->th = barrect.height; |
|
| 111 | 112 | update_size(c); |
|
| 112 | 113 | XSetWindowBorderWidth(dpy, c->win, 1); |
|
| 114 | + | XSetWindowBorder(dpy, c->win, brush.border); |
|
| 113 | 115 | XSelectInput(dpy, c->win, CLIENT_MASK); |
|
| 114 | 116 | XGetTransientForHint(dpy, c->win, &c->trans); |
|
| 115 | 117 | twa.override_redirect = 1; |
|
| 116 | 118 | twa.background_pixmap = ParentRelative; |
|
| 117 | - | twa.event_mask = ExposureMask; |
|
| 119 | + | twa.event_mask = SubstructureNotifyMask | ExposureMask; |
|
| 118 | 120 | ||
| 119 | - | c->title = XCreateWindow(dpy, root, c->x, c->y, c->w, barrect.height, |
|
| 121 | + | c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, |
|
| 120 | 122 | 0, DefaultDepth(dpy, screen), CopyFromParent, |
|
| 121 | 123 | DefaultVisual(dpy, screen), |
|
| 122 | 124 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); |
|
| 145 | 147 | XConfigureEvent e; |
|
| 146 | 148 | ||
| 147 | 149 | XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); |
|
| 148 | - | XMoveResizeWindow(dpy, c->title, c->x + c->w / 3, c->y, 2 * c->w / 3, barrect.height); |
|
| 149 | 150 | e.type = ConfigureNotify; |
|
| 150 | 151 | e.event = c->win; |
|
| 151 | 152 | e.window = c->win; |
|
| 177 | 178 | XSetErrorHandler(dummy_error_handler); |
|
| 178 | 179 | ||
| 179 | 180 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
|
| 180 | - | XUnmapWindow(dpy, c->win); |
|
| 181 | 181 | XDestroyWindow(dpy, c->title); |
|
| 182 | 182 | ||
| 183 | 183 | for(l=&clients; *l && *l != c; l=&(*l)->next); |
|
| 210 | 210 | void |
|
| 211 | 211 | draw_client(Client *c) |
|
| 212 | 212 | { |
|
| 213 | - | if(!c) |
|
| 214 | - | return; |
|
| 215 | 213 | if(c == stack) |
|
| 216 | 214 | draw_bar(); |
|
| 217 | 215 | ||
| 216 | + | c->tw = textwidth(&brush.font, c->name) + labelheight(&brush.font); |
|
| 217 | + | c->tx = c->x + c->w - c->tw + 2; |
|
| 218 | + | c->ty = c->y; |
|
| 219 | + | XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th); |
|
| 220 | + | ||
| 218 | 221 | brush.rect.x = brush.rect.y = 0; |
|
| 219 | - | brush.rect.width = 2 * c->w / 3; |
|
| 220 | - | brush.rect.height = barrect.height; |
|
| 222 | + | brush.rect.width = c->tw; |
|
| 223 | + | brush.rect.height = c->th; |
|
| 221 | 224 | ||
| 222 | 225 | draw(dpy, &brush, True, c->name); |
|
| 223 | - | XCopyArea(dpy, brush.drawable, c->title, brush.gc, 0, 0, |
|
| 224 | - | brush.rect.width, brush.rect.height, 0, 0); |
|
| 226 | + | XCopyArea(dpy, brush.drawable, c->title, brush.gc, |
|
| 227 | + | 0, 0, c->tw, c->th, 0, 0); |
|
| 225 | 228 | XFlush(dpy); |
|
| 226 | 229 | } |
|
| 6 | 6 | #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*" |
|
| 7 | 7 | #define BGCOLOR "#000000" |
|
| 8 | 8 | #define FGCOLOR "#ffaa00" |
|
| 9 | - | #define BORDERCOLOR "#000000" |
|
| 9 | + | #define BORDERCOLOR "#ee8800" |
|
| 10 | 10 | #define STATUSDELAY 10 /* milliseconds */ |
| 204 | 204 | } |
|
| 205 | 205 | if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) { |
|
| 206 | 206 | update_name(c); |
|
| 207 | + | if(c == stack) |
|
| 208 | + | draw_bar(); |
|
| 209 | + | else |
|
| 210 | + | draw_client(c); |
|
| 207 | 211 | } |
|
| 208 | 212 | } |
|
| 209 | 213 | } |
| 25 | 25 | char name[256], tag[256]; |
|
| 26 | 26 | int proto; |
|
| 27 | 27 | int x, y, w, h; |
|
| 28 | + | int tx, ty, tw, th; |
|
| 28 | 29 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
|
| 29 | 30 | long flags; |
|
| 30 | 31 | Window win; |