# HG changeset patch # User Anselm R. Garbe # Date 1152654399 -7200 # Node ID bd3a44353916628fed2f2327e59a762f957fdb0a # Parent 3ef108a5ca0a92b0e6e02a9701765c72942d827c fixed several other stuff, coming closer to something useful diff -r 3ef108a5ca0a -r bd3a44353916 bar.c --- a/bar.c Tue Jul 11 23:18:30 2006 +0200 +++ b/bar.c Tue Jul 11 23:46:39 2006 +0200 @@ -15,7 +15,7 @@ if(stack) { brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font); swap((void **)&brush.fg, (void **)&brush.bg); - draw(dpy, &brush, False, stack->name); + draw(dpy, &brush, True, stack->name); swap((void **)&brush.fg, (void **)&brush.bg); brush.rect.x += brush.rect.width; } diff -r 3ef108a5ca0a -r bd3a44353916 client.c --- a/client.c Tue Jul 11 23:18:30 2006 +0200 +++ b/client.c Tue Jul 11 23:46:39 2006 +0200 @@ -104,19 +104,21 @@ c = emallocz(sizeof(Client)); c->win = w; - c->x = wa->x; - c->y = wa->y; - c->w = wa->width; + c->tx = c->x = wa->x; + c->ty = c->y = wa->y; + c->tw = c->w = wa->width; c->h = wa->height; + c->th = barrect.height; update_size(c); XSetWindowBorderWidth(dpy, c->win, 1); + XSetWindowBorder(dpy, c->win, brush.border); XSelectInput(dpy, c->win, CLIENT_MASK); XGetTransientForHint(dpy, c->win, &c->trans); twa.override_redirect = 1; twa.background_pixmap = ParentRelative; - twa.event_mask = ExposureMask; + twa.event_mask = SubstructureNotifyMask | ExposureMask; - c->title = XCreateWindow(dpy, root, c->x, c->y, c->w, barrect.height, + 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); @@ -145,7 +147,6 @@ XConfigureEvent e; XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); - XMoveResizeWindow(dpy, c->title, c->x + c->w / 3, c->y, 2 * c->w / 3, barrect.height); e.type = ConfigureNotify; e.event = c->win; e.window = c->win; @@ -177,7 +178,6 @@ XSetErrorHandler(dummy_error_handler); XUngrabButton(dpy, AnyButton, AnyModifier, c->win); - XUnmapWindow(dpy, c->win); XDestroyWindow(dpy, c->title); for(l=&clients; *l && *l != c; l=&(*l)->next); @@ -210,17 +210,20 @@ void draw_client(Client *c) { - if(!c) - return; if(c == stack) draw_bar(); + c->tw = textwidth(&brush.font, c->name) + labelheight(&brush.font); + c->tx = c->x + c->w - c->tw + 2; + c->ty = c->y; + XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th); + brush.rect.x = brush.rect.y = 0; - brush.rect.width = 2 * c->w / 3; - brush.rect.height = barrect.height; + brush.rect.width = c->tw; + brush.rect.height = c->th; draw(dpy, &brush, True, c->name); - XCopyArea(dpy, brush.drawable, c->title, brush.gc, 0, 0, - brush.rect.width, brush.rect.height, 0, 0); + XCopyArea(dpy, brush.drawable, c->title, brush.gc, + 0, 0, c->tw, c->th, 0, 0); XFlush(dpy); } diff -r 3ef108a5ca0a -r bd3a44353916 config.h --- a/config.h Tue Jul 11 23:18:30 2006 +0200 +++ b/config.h Tue Jul 11 23:46:39 2006 +0200 @@ -6,5 +6,5 @@ #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*" #define BGCOLOR "#000000" #define FGCOLOR "#ffaa00" -#define BORDERCOLOR "#000000" +#define BORDERCOLOR "#ee8800" #define STATUSDELAY 10 /* milliseconds */ diff -r 3ef108a5ca0a -r bd3a44353916 event.c --- a/event.c Tue Jul 11 23:18:30 2006 +0200 +++ b/event.c Tue Jul 11 23:46:39 2006 +0200 @@ -204,6 +204,10 @@ } if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) { update_name(c); + if(c == stack) + draw_bar(); + else + draw_client(c); } } } diff -r 3ef108a5ca0a -r bd3a44353916 wm.h --- a/wm.h Tue Jul 11 23:18:30 2006 +0200 +++ b/wm.h Tue Jul 11 23:46:39 2006 +0200 @@ -25,6 +25,7 @@ char name[256], tag[256]; int proto; int x, y, w, h; + int tx, ty, tw, th; int basew, baseh, incw, inch, maxw, maxh, minw, minh; long flags; Window win;