Skip to content

Commit

Permalink
FvwmButtons: Shrink windows when honoring Hints.
Browse files Browse the repository at this point in the history
When Swallowing a window and honoring 'Hints', shrink the window
to fit the button (instead of growing it) so the window fits inside
the button and isn't cut off. Fallback to growing the window if
shrinking makes it smaller than min size.

Fixes #573
  • Loading branch information
somiaj authored and ThomasAdam committed Jul 12, 2021
1 parent 8023fda commit dfeb668
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions modules/FvwmButtons/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,41 +148,41 @@ void ConstrainSize (XSizeHints *hints, int *widthp, int *heightp)
if (minAspectX * dheight > minAspectY * dwidth)
{
delta = makemult(
minAspectX * dheight / minAspectY - dwidth,
xinc);
if (dwidth + delta <= maxWidth)
dheight - minAspectY * dwidth / minAspectX,
yinc);
if (dheight - delta >= minHeight)
{
dwidth += delta;
dheight -= delta;
}
else
{
delta = makemult(
dheight - minAspectY*dwidth/minAspectX,
yinc);
if (dheight - delta >= minHeight)
minAspectX * dheight / minAspectY -
dwidth, xinc);
if (dwidth + delta <= maxWidth)
{
dheight -= delta;
dwidth += delta;
}
}
}

if (maxAspectX * dheight < maxAspectY * dwidth)
{
delta = makemult(
dwidth * maxAspectY / maxAspectX - dheight,
yinc);
if (dheight + delta <= maxHeight)
dwidth - maxAspectX * dheight / maxAspectY,
xinc);
if (dwidth - delta >= minWidth)
{
dheight += delta;
dwidth -= delta;
}
else
{
delta = makemult(
dwidth - maxAspectX*dheight/maxAspectY,
xinc);
if (dwidth - delta >= minWidth)
dwidth * maxAspectY / maxAspectX -
dheight, yinc);
if (dheight + delta <= maxHeight)
{
dwidth -= delta;
dheight += delta;
}
}
}
Expand Down

0 comments on commit dfeb668

Please sign in to comment.