You are not logged in.

#1 2021-11-17 02:47:06

John Path
Member
Registered: 2021-10-15
Posts: 57

Cannot Patch functional gaps + pertag and stackmfact in DWM

Hi everyone,

I patched "functional gaps + pertag" weeks ago and now i need "stackmfact" patch to adjust vertical height of terminal.
I must mannually add the following thing in dwm.c

 void
 tile(Monitor *m) {
-	unsigned int i, n, h, mw, my, ty;
+	unsigned int i, n, h, smh, mw, my, ty;
 	Client *c;
 
 	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
@@ -1721,9 +1738,23 @@ tile(Monitor *m) {
 			my += HEIGHT(c);
 		}
 		else {
-			h = (m->wh - ty) / (n - i);
-			resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
-			ty += HEIGHT(c);
+			smh = m->mh * m->smfact;
+			if(!(nexttiled(c->next)))
+				h = (m->wh - ty) / (n - i);
+			else
+				h = (m->wh - smh - ty) / (n - i);
+			if(h < minwsz) {
+				c->isfloating = True;
+				XRaiseWindow(dpy, c->win);
+				resize(c, m->mx + (m->mw / 2 - WIDTH(c) / 2), m->my + (m->mh / 2 - HEIGHT(c) / 2), m->ww - mw - (2*c->bw), h - (2*c->bw), False);
+				ty -= HEIGHT(c);
+			}
+			else
+				resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
+			if(!(nexttiled(c->next)))
+				ty += HEIGHT(c) + smh;
+			else
+				ty += HEIGHT(c);
 		}
 }

but in my dwm.c file the line that should be removed are totally different because of the "functional gaps + pertag"

void
tile(Monitor *m)
{
	unsigned int i, n, h, mw, my, ty;
	Client *c;

	for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
	if (n == 0)
		return;

	if (m->pertag->drawwithgaps[m->pertag->curtag]) { /* draw with fullgaps logic */
	    if (n > m->nmaster)
			mw = m->nmaster ? m->ww * m->mfact : 0;
	    else
	                mw = m->ww - m->pertag->gappx[m->pertag->curtag];
	    for (i = 0, my = ty = m->pertag->gappx[m->pertag->curtag], c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
	          if (i < m->nmaster) {
	                  h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->pertag->gappx[m->pertag->curtag];
	                  resize(c, m->wx + m->pertag->gappx[m->pertag->curtag], m->wy + my, mw - (2*c->bw) - m->pertag->gappx[m->pertag->curtag], h - (2*c->bw), 0);
	                  if (my + HEIGHT(c) + m->pertag->gappx[m->pertag->curtag] < m->wh)
	                         my += HEIGHT(c) + m->pertag->gappx[m->pertag->curtag];
	         } else {
	                 h = (m->wh - ty) / (n - i) - m->pertag->gappx[m->pertag->curtag];
	                 resize(c, m->wx + mw + m->pertag->gappx[m->pertag->curtag], m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->pertag->gappx[m->pertag->curtag], h - (2*c->bw), 0);
	                  if (ty + HEIGHT(c) + m->pertag->gappx[m->pertag->curtag] < m->wh)
	                          ty += HEIGHT(c) + m->pertag->gappx[m->pertag->curtag];
	                }
	} else { /* draw with singularborders logic */
	        if (n > m->nmaster)
	                mw = m->nmaster ? m->ww * m->mfact : 0;
	        else
	                mw = m->ww;
	        for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
	                if (i < m->nmaster) {
	                        h = (m->wh - my) / (MIN(n, m->nmaster) - i);
	                        if (n == 1)
	                                resize(c, m->wx - c->bw, m->wy, m->ww, m->wh, False);
	                        else
	                                resize(c, m->wx - c->bw, m->wy + my, mw - c->bw, h - c->bw, False);
	                        my += HEIGHT(c) - c->bw;
	                } else {
	                        h = (m->wh - ty) / (n - i);
				resize(c, m->wx + mw - c->bw, m->wy + ty, m->ww - mw, h - c->bw, False);
	                        ty += HEIGHT(c) - c->bw;
	                }
	}
}

I know this is messy but i really need help right now.

Thanks for replying in advance.

Offline

Board footer

Powered by FluxBB