sites

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

tabbed-autohide-20170824-6dc3978.diff (1435B)


      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;
     12  static Bool running = True, nextfocus, doinitspawn = True,
     13              fillagain = False, closelastclient = False,
     14 @@ -315,7 +315,7 @@ void
     15  drawbar(void)
     16  {
     17  	XftColor *col;
     18 -	int c, cc, fc, width;
     19 +	int c, cc, fc, width, nbh, i;
     20  	char *name = NULL;
     21  
     22  	if (nclients == 0) {
     23 @@ -323,12 +323,21 @@ drawbar(void)
     24  		dc.w = ww;
     25  		XFetchName(dpy, win, &name);
     26  		drawtext(name ? name : "", dc.norm);
     27 -		XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, bh, 0, 0);
     28 +		XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, ww, vbh, 0, 0);
     29  		XSync(dpy, False);
     30  
     31  		return;
     32  	}
     33  
     34 +	nbh = nclients > 1 ? vbh : 0;
     35 +	if (bh != nbh) {
     36 +		bh = nbh;
     37 +		for (i = 0; i < nclients; i++)
     38 +			XMoveResizeWindow(dpy, clients[i]->win, 0, bh, ww, wh - bh);
     39 +	}
     40 +	if (bh == 0)
     41 +		return;
     42 +
     43  	width = ww;
     44  	cc = ww / tabwidth;
     45  	if (nclients > cc)
     46 @@ -975,7 +984,7 @@ setup(void)
     47  	screen = DefaultScreen(dpy);
     48  	root = RootWindow(dpy, screen);
     49  	initfont(font);
     50 -	bh = dc.h = dc.font.height + 2;
     51 +	vbh = dc.h = dc.font.height + 2;
     52  
     53  	/* init atoms */
     54  	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);