sites

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

tabbed-0.4.1-autohide.diff (1528B)


      1 diff -up ../tabbed-0.4.1/tabbed.c ./tabbed.c
      2 --- ../tabbed-0.4.1/tabbed.c	2012-08-20 09:15:07.000000000 +0200
      3 +++ ./tabbed.c	2012-11-08 20:02:21.048334570 +0100
      4 @@ -142,7 +142,7 @@ static void (*handler[LASTEvent]) (const
      5  	[MapRequest] = maprequest,
      6  	[PropertyNotify] = propertynotify,
      7  };
      8 -static int bh, wx, wy, ww, wh;
      9 +static int vbh, bh, wx, wy, ww, wh;
     10  static unsigned int numlockmask = 0;
     11  static Bool running = True, nextfocus, doinitspawn = True;
     12  static Display *dpy;
     13 @@ -283,7 +283,7 @@ die(const char *errstr, ...) {
     14  void
     15  drawbar() {
     16  	unsigned long *col;
     17 -	int n, width;
     18 +	int n, width, nbh;
     19  	Client *c, *fc;
     20  	char *name = NULL;
     21  
     22 @@ -292,10 +292,18 @@ drawbar() {
     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  		return;
     30  	}
     31 +		nbh = clients->next ? vbh : 0;
     32 +	if (nbh != bh) {
     33 +		bh = nbh;
     34 +		for (c = clients; c; c = c->next)
     35 +			XMoveResizeWindow(dpy, c->win, 0, bh, ww, wh - bh);
     36 +	}
     37 +	if (bh == 0)
     38 +		return;
     39  	width = ww;
     40  	for(c = clients; c; c = c->next)
     41  		c->tabx = -1;
     42 @@ -736,7 +744,7 @@ setup(void) {
     43  	screen = DefaultScreen(dpy);
     44  	root = RootWindow(dpy, screen);
     45  	initfont(font);
     46 -	bh = dc.h = dc.font.height + 2;
     47 +	vbh = dc.h = dc.font.height + 2;
     48  	/* init atoms */
     49  	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
     50  	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);