sites

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

tabbed-autohide-20201222-dabf6a2.diff (1446B)


      1 diff --git a/tabbed.c b/tabbed.c
      2 index eafe28a..b0b9662 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, obh, wx, wy, ww, wh;
     10 +static int bh, obh, wx, wy, ww, wh, vbh;
     11  static unsigned int numlockmask;
     12  static Bool running = True, nextfocus, doinitspawn = True,
     13              fillagain = False, closelastclient = False,
     14 @@ -324,7 +324,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 @@ -332,12 +332,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 @@ -984,7 +993,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);