sites

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

dwm-autoresize-20160718-56a31dc.diff (1089B)


      1 diff --git a/dwm.c b/dwm.c
      2 index b2bc9bd..3002925 100644
      3 --- a/dwm.c
      4 +++ b/dwm.c
      5 @@ -93,7 +93,7 @@ struct Client {
      6  	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
      7  	int bw, oldbw;
      8  	unsigned int tags;
      9 -	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
     10 +	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, needresize;
     11  	Client *next;
     12  	Client *snext;
     13  	Monitor *mon;
     14 @@ -625,6 +625,8 @@ configurerequest(XEvent *e)
     15  				configure(c);
     16  			if (ISVISIBLE(c))
     17  				XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
     18 +			else
     19 +				c->needresize = 1;
     20  		} else
     21  			configure(c);
     22  	} else {
     23 @@ -1610,6 +1612,12 @@ showhide(Client *c)
     24  	if (ISVISIBLE(c)) {
     25  		/* show clients top down */
     26  		XMoveWindow(dpy, c->win, c->x, c->y);
     27 +		if (c->needresize) {
     28 +			c->needresize = 0;
     29 +			XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
     30 +		} else {
     31 +			XMoveWindow(dpy, c->win, c->x, c->y);
     32 +		}
     33  		if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
     34  			resize(c, c->x, c->y, c->w, c->h, 0);
     35  		showhide(c->snext);