sites

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

dwm-uselessgap-6.1.diff (1966B)


      1 --- dwm/dwm.c.orig	2015-11-22 13:26:16.664650238 -0700
      2 +++ dwm/dwm.c	2015-11-22 13:25:57.407984351 -0700
      3 @@ -52,8 +52,8 @@
      4  #define ISVISIBLE(C)            ((C->tags & C->mon->tagset[C->mon->seltags]))
      5  #define LENGTH(X)               (sizeof X / sizeof X[0])
      6  #define MOUSEMASK               (BUTTONMASK|PointerMotionMask)
      7 -#define WIDTH(X)                ((X)->w + 2 * (X)->bw)
      8 -#define HEIGHT(X)               ((X)->h + 2 * (X)->bw)
      9 +#define WIDTH(X)                ((X)->w + 2 * (X)->bw + gappx)
     10 +#define HEIGHT(X)               ((X)->h + 2 * (X)->bw + gappx)
     11  #define TAGMASK                 ((1 << LENGTH(tags)) - 1)
     12  #define TEXTW(X)                (drw_text(drw, 0, 0, 0, 0, (X), 0) + drw->fonts[0]->h)
     13  
     14 @@ -1293,12 +1293,36 @@ void
     15  resizeclient(Client *c, int x, int y, int w, int h)
     16  {
     17  	XWindowChanges wc;
     18 +	unsigned int n;
     19 +	unsigned int gapoffset;
     20 +	unsigned int gapincr;
     21 +	Client *nbc;
     22  
     23 -	c->oldx = c->x; c->x = wc.x = x;
     24 -	c->oldy = c->y; c->y = wc.y = y;
     25 -	c->oldw = c->w; c->w = wc.width = w;
     26 -	c->oldh = c->h; c->h = wc.height = h;
     27  	wc.border_width = c->bw;
     28 +
     29 +	/* Get number of clients for the selected monitor */
     30 +	for (n = 0, nbc = nexttiled(selmon->clients); nbc; nbc = nexttiled(nbc->next), n++);
     31 +
     32 +	/* Do nothing if layout is floating */
     33 +	if (c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) {
     34 +		gapincr = gapoffset = 0;
     35 +	} else {
     36 +		/* Remove border and gap if layout is monocle or only one client */
     37 +		if (selmon->lt[selmon->sellt]->arrange == monocle || n == 1) {
     38 +			gapoffset = 0;
     39 +			gapincr = -2 * borderpx;
     40 +			wc.border_width = 0;
     41 +		} else {
     42 +			gapoffset = gappx;
     43 +			gapincr = 2 * gappx;
     44 +		}
     45 +	}
     46 +
     47 +	c->oldx = c->x; c->x = wc.x = x + gapoffset;
     48 +	c->oldy = c->y; c->y = wc.y = y + gapoffset;
     49 +	c->oldw = c->w; c->w = wc.width = w - gapincr;
     50 +	c->oldh = c->h; c->h = wc.height = h - gapincr;
     51 +
     52  	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
     53  	configure(c);
     54  	XSync(dpy, False);