sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

tabbed-autohide-0.6.diff (1340B)


      1 diff --git a/tabbed.c b/tabbed.c
      2 index ff3ada0..c41db0c 100644
      3 --- a/tabbed.c
      4 +++ b/tabbed.c
      5 @@ -152,7 +152,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
      6  	[MapRequest] = maprequest,
      7  	[PropertyNotify] = propertynotify,
      8  };
      9 -static int bh, wx, wy, ww, wh;
     10 +static int bh, wx, wy, ww, wh, vbh;
     11  static unsigned int numlockmask = 0;
     12  static Bool running = True, nextfocus, doinitspawn = True,
     13              fillagain = False, closelastclient = False;
     14 @@ -307,6 +307,6 @@ void
     15  drawbar(void) {
     16  	unsigned long *col;
     17 -	int c, fc, width, n = 0;
     18 +	int c, fc, width, n = 0, nbh, i;
     19  	char *name = NULL;
     20  
     21  	if (nclients == 0) {
     22 @@ -314,10 +314,19 @@ drawbar(void)
     23  		dc.w = ww;
     24  		XFetchName(dpy, win, &name);
     25  		drawtext(name ? name : "", dc.norm);
     26 -		XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, bh, 0, 0);
     27 +		XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, vbh, 0, 0);
     28  		XSync(dpy, False);
     29  
     30  		return;
     31  	}
     32  
     33 +	nbh = nclients > 1 ? vbh : 0;
     34 +	if (bh != nbh) {
     35 +		bh = nbh;
     36 +		for (i = 0; i < nclients; i++)
     37 +			XMoveResizeWindow(dpy, clients[i]->win, 0, bh, ww, wh - bh);
     38 +	}
     39 +	if (bh == 0)
     40 +		return;
     41 +
     42  	width = ww;
     43 @@ -920,6 +929,6 @@ setup(void)
     44  	screen = DefaultScreen(dpy);
     45  	root = RootWindow(dpy, screen);
     46  	initfont(font);
     47 -	bh = dc.h = dc.font.height + 2;
     48 +	vbh = dc.h = dc.font.height + 2;
     49  
     50  	/* init atoms */