@pancake :
> I dont see any point for having a function called
> "dwmiinoinfiniteloop"
Well this function is necessary, I didn't know how to call it,
though its name is relevant... If you don't like its name feel free
to change it but I won't. The important thing is that it does its job.
I think what "pancake" meant is that code that needs a function
called "dwmiinoinfiniteloop" can usually be rewritten to not require
it, improving maintainability. From what I can tell, it unsets the
second dwmii bit it finds, merging the second column of windows into
the first column. Why?
--snip--
void dwmiinoinfiniteloop(void)
{
Client* firstclients = nexttiled(clients),*t = firstclients;
for( ; t && !t->dwmii ; t = nexttiled(t->next) );
firstclients->dwmii = 1;
if ( t && (t != firstclients) ) { t->dwmii = 0; }
}
The code below contains lots of "if's" that seem to be always true
(or should be). Why check them? You don't call dwmiilayoutcol unless
if (lt[sellt]->arrange == dwmiilayoutcol). Also, the line
if (t->dwmii)
should always be true. Otherwise, you'll get an infinite loop. I
think it'd be better to remove this check (and not explicitly set
firstclients->dwmii=1). This might work better for the case of
windows having multiple tags...
void dwmiilayoutcol(void)
{
Client *firstclients = nexttiled(clients);
if ( !firstclients || (lt[sellt]->arrange != dwmiilayoutcol) )
{ return; }
dwmiinoinfiniteloop();
Client *t = nexttiled(firstclients->next);
int n = 1;
for( ; t ; n += ( t->dwmii ? 1 : 0 ),t = nexttiled(t->next) );
int x = wx,dw = ww / n;
for ( t = firstclients ; t ; )
{
if ( t->dwmii )
{
n = 1;
Client *s = nexttiled(t->next);
for( ; s && !s->dwmii ; n++,s = nexttiled(s->next) );
int dh = wh / n,y = wy + dh;
resize(t,x,wy,dw - 2 * t->bw,dh - 2 *
t->bw,resizehints);
for( t = nexttiled(t->next) ; t && !t->dwmii ; t = nexttiled(t-
>next) )
{
resize(t,x,y,dw - 2 * t->bw,dh - 2 *
t->bw,resizehints);
y += dh;
}
x += dw;
}
}
}