dwm-meillo

changeset 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
files bar.c client.c config.h event.c wm.h
diffstat 5 files changed, 23 insertions(+), 15 deletions(-) [+]
line diff
     1.1 --- a/bar.c	Tue Jul 11 23:18:30 2006 +0200
     1.2 +++ b/bar.c	Tue Jul 11 23:46:39 2006 +0200
     1.3 @@ -15,7 +15,7 @@
     1.4  	if(stack) {
     1.5  		brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font);
     1.6  		swap((void **)&brush.fg, (void **)&brush.bg);
     1.7 -		draw(dpy, &brush, False, stack->name);
     1.8 +		draw(dpy, &brush, True, stack->name);
     1.9  		swap((void **)&brush.fg, (void **)&brush.bg);
    1.10  		brush.rect.x += brush.rect.width;
    1.11  	}
     2.1 --- a/client.c	Tue Jul 11 23:18:30 2006 +0200
     2.2 +++ b/client.c	Tue Jul 11 23:46:39 2006 +0200
     2.3 @@ -104,19 +104,21 @@
     2.4  
     2.5  	c = emallocz(sizeof(Client));
     2.6  	c->win = w;
     2.7 -	c->x = wa->x;
     2.8 -	c->y = wa->y;
     2.9 -	c->w = wa->width;
    2.10 +	c->tx = c->x = wa->x;
    2.11 +	c->ty = c->y = wa->y;
    2.12 +	c->tw = c->w = wa->width;
    2.13  	c->h = wa->height;
    2.14 +	c->th = barrect.height;
    2.15  	update_size(c);
    2.16  	XSetWindowBorderWidth(dpy, c->win, 1);
    2.17 +	XSetWindowBorder(dpy, c->win, brush.border);
    2.18  	XSelectInput(dpy, c->win, CLIENT_MASK);
    2.19  	XGetTransientForHint(dpy, c->win, &c->trans);
    2.20  	twa.override_redirect = 1;
    2.21  	twa.background_pixmap = ParentRelative;
    2.22 -	twa.event_mask = ExposureMask;
    2.23 +	twa.event_mask = SubstructureNotifyMask | ExposureMask;
    2.24  
    2.25 -	c->title = XCreateWindow(dpy, root, c->x, c->y, c->w, barrect.height,
    2.26 +	c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
    2.27  			0, DefaultDepth(dpy, screen), CopyFromParent,
    2.28  			DefaultVisual(dpy, screen),
    2.29  			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
    2.30 @@ -145,7 +147,6 @@
    2.31  	XConfigureEvent e;
    2.32  
    2.33  	XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
    2.34 -	XMoveResizeWindow(dpy, c->title, c->x + c->w / 3, c->y, 2 * c->w / 3, barrect.height);
    2.35  	e.type = ConfigureNotify;
    2.36  	e.event = c->win;
    2.37  	e.window = c->win;
    2.38 @@ -177,7 +178,6 @@
    2.39  	XSetErrorHandler(dummy_error_handler);
    2.40  
    2.41  	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
    2.42 -	XUnmapWindow(dpy, c->win);
    2.43  	XDestroyWindow(dpy, c->title);
    2.44  
    2.45  	for(l=&clients; *l && *l != c; l=&(*l)->next);
    2.46 @@ -210,17 +210,20 @@
    2.47  void
    2.48  draw_client(Client *c)
    2.49  {
    2.50 -	if(!c)
    2.51 -		return;
    2.52  	if(c == stack)
    2.53  		draw_bar();
    2.54  
    2.55 +	c->tw = textwidth(&brush.font, c->name) + labelheight(&brush.font);
    2.56 +	c->tx = c->x + c->w - c->tw + 2;
    2.57 +	c->ty = c->y;
    2.58 +	XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th);
    2.59 +
    2.60  	brush.rect.x = brush.rect.y = 0;
    2.61 -	brush.rect.width = 2 * c->w / 3;
    2.62 -	brush.rect.height = barrect.height;
    2.63 +	brush.rect.width = c->tw;
    2.64 +	brush.rect.height = c->th;
    2.65  
    2.66  	draw(dpy, &brush, True, c->name);
    2.67 -	XCopyArea(dpy, brush.drawable, c->title, brush.gc, 0, 0,
    2.68 -			brush.rect.width, brush.rect.height, 0, 0);
    2.69 +	XCopyArea(dpy, brush.drawable, c->title, brush.gc,
    2.70 +			0, 0, c->tw, c->th, 0, 0);
    2.71  	XFlush(dpy);
    2.72  }
     3.1 --- a/config.h	Tue Jul 11 23:18:30 2006 +0200
     3.2 +++ b/config.h	Tue Jul 11 23:46:39 2006 +0200
     3.3 @@ -6,5 +6,5 @@
     3.4  #define FONT		"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
     3.5  #define BGCOLOR		"#000000"
     3.6  #define FGCOLOR		"#ffaa00"
     3.7 -#define BORDERCOLOR	"#000000"
     3.8 +#define BORDERCOLOR	"#ee8800"
     3.9  #define STATUSDELAY	10 /* milliseconds */
     4.1 --- a/event.c	Tue Jul 11 23:18:30 2006 +0200
     4.2 +++ b/event.c	Tue Jul 11 23:46:39 2006 +0200
     4.3 @@ -204,6 +204,10 @@
     4.4  		}
     4.5  		if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) {
     4.6  			update_name(c);
     4.7 +			if(c == stack)
     4.8 +				draw_bar();
     4.9 +			else
    4.10 +				draw_client(c);
    4.11  		}
    4.12  	}
    4.13  }
     5.1 --- a/wm.h	Tue Jul 11 23:18:30 2006 +0200
     5.2 +++ b/wm.h	Tue Jul 11 23:46:39 2006 +0200
     5.3 @@ -25,6 +25,7 @@
     5.4  	char name[256], tag[256];
     5.5  	int proto;
     5.6  	int x, y, w, h;
     5.7 +	int tx, ty, tw, th;
     5.8  	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
     5.9  	long flags; 
    5.10  	Window win;