Cfactor: Add exception for parent client and same size

This commit is contained in:
Martin Duquesnoy 2011-05-10 22:06:00 +02:00
parent c8b9b41a3e
commit 4cda38ce26

View File

@ -130,7 +130,7 @@ cfactor_parentrow(XRectangle cg, XRectangle ccg, Position p)
*\param fac Factor of resizing
*/
static void
cfactor_arrange_row(Client *c, Position p, int fac)
_cfactor_arrange_row(Client *c, Position p, int fac)
{
XRectangle cgeo = c->frame_geo;
Client *cc;
@ -146,6 +146,34 @@ cfactor_arrange_row(Client *c, Position p, int fac)
return;
}
static void
cfactor_arrange_two(Client *c1, Client *c2, Position p, int fac)
{
c1->tilefact[p] += fac;
c2->tilefact[RPOS(p)] -= fac;
client_moveresize(c1, c1->geo, tags[c1->screen][c1->tag].resizehint);
client_moveresize(c2, c2->geo, tags[c2->screen][c2->tag].resizehint);
return;
}
static void
cfactor_arrange_row(Client *c, Client *gc, Position p, int fac)
{
if(((p == Top || p == Bottom) && gc->geo.width == c->geo.width)
|| ((p == Right || p == Left) && gc->geo.height == c->geo.height))
cfactor_arrange_two(c, gc, p, fac);
else
{
_cfactor_arrange_row(c, p, fac);
_cfactor_arrange_row(gc, RPOS(p), -fac);
}
return;
}
/** Check future geometry of factorized client
*\param c Client pointer
*\param g Client pointer
@ -203,8 +231,7 @@ cfactor_set(Client *c, Position p, int fac)
return;
/* Arrange client and row parents */
cfactor_arrange_row(c, p, fac);
cfactor_arrange_row(gc, RPOS(p), -fac);
cfactor_arrange_row(c, gc, p, fac);
return;
}