dwm-meillo

diff client.c @ 22:bd3a44353916

fixed several other stuff, coming closer to something useful
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 11 Jul 2006 23:46:39 +0200
parents 3ef108a5ca0a
children 95ffdfd0a819
line diff
     1.1 --- a/client.c	Tue Jul 11 23:18:30 2006 +0200
     1.2 +++ b/client.c	Tue Jul 11 23:46:39 2006 +0200
     1.3 @@ -104,19 +104,21 @@
     1.4  
     1.5  	c = emallocz(sizeof(Client));
     1.6  	c->win = w;
     1.7 -	c->x = wa->x;
     1.8 -	c->y = wa->y;
     1.9 -	c->w = wa->width;
    1.10 +	c->tx = c->x = wa->x;
    1.11 +	c->ty = c->y = wa->y;
    1.12 +	c->tw = c->w = wa->width;
    1.13  	c->h = wa->height;
    1.14 +	c->th = barrect.height;
    1.15  	update_size(c);
    1.16  	XSetWindowBorderWidth(dpy, c->win, 1);
    1.17 +	XSetWindowBorder(dpy, c->win, brush.border);
    1.18  	XSelectInput(dpy, c->win, CLIENT_MASK);
    1.19  	XGetTransientForHint(dpy, c->win, &c->trans);
    1.20  	twa.override_redirect = 1;
    1.21  	twa.background_pixmap = ParentRelative;
    1.22 -	twa.event_mask = ExposureMask;
    1.23 +	twa.event_mask = SubstructureNotifyMask | ExposureMask;
    1.24  
    1.25 -	c->title = XCreateWindow(dpy, root, c->x, c->y, c->w, barrect.height,
    1.26 +	c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
    1.27  			0, DefaultDepth(dpy, screen), CopyFromParent,
    1.28  			DefaultVisual(dpy, screen),
    1.29  			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
    1.30 @@ -145,7 +147,6 @@
    1.31  	XConfigureEvent e;
    1.32  
    1.33  	XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
    1.34 -	XMoveResizeWindow(dpy, c->title, c->x + c->w / 3, c->y, 2 * c->w / 3, barrect.height);
    1.35  	e.type = ConfigureNotify;
    1.36  	e.event = c->win;
    1.37  	e.window = c->win;
    1.38 @@ -177,7 +178,6 @@
    1.39  	XSetErrorHandler(dummy_error_handler);
    1.40  
    1.41  	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
    1.42 -	XUnmapWindow(dpy, c->win);
    1.43  	XDestroyWindow(dpy, c->title);
    1.44  
    1.45  	for(l=&clients; *l && *l != c; l=&(*l)->next);
    1.46 @@ -210,17 +210,20 @@
    1.47  void
    1.48  draw_client(Client *c)
    1.49  {
    1.50 -	if(!c)
    1.51 -		return;
    1.52  	if(c == stack)
    1.53  		draw_bar();
    1.54  
    1.55 +	c->tw = textwidth(&brush.font, c->name) + labelheight(&brush.font);
    1.56 +	c->tx = c->x + c->w - c->tw + 2;
    1.57 +	c->ty = c->y;
    1.58 +	XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th);
    1.59 +
    1.60  	brush.rect.x = brush.rect.y = 0;
    1.61 -	brush.rect.width = 2 * c->w / 3;
    1.62 -	brush.rect.height = barrect.height;
    1.63 +	brush.rect.width = c->tw;
    1.64 +	brush.rect.height = c->th;
    1.65  
    1.66  	draw(dpy, &brush, True, c->name);
    1.67 -	XCopyArea(dpy, brush.drawable, c->title, brush.gc, 0, 0,
    1.68 -			brush.rect.width, brush.rect.height, 0, 0);
    1.69 +	XCopyArea(dpy, brush.drawable, c->title, brush.gc,
    1.70 +			0, 0, c->tw, c->th, 0, 0);
    1.71  	XFlush(dpy);
    1.72  }