Improve aspect size handling

The window is now no longer enlarged to make it fit into its aspect ratio, but
only ever made lower. This was verified with a small test app that sets a min
aspect ratio of 0.5 and max aspect ratio of 2.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-07-22 10:32:57 +02:00
parent 227b71921d
commit 9977802d7e
1 changed files with 5 additions and 4 deletions

View File

@ -818,15 +818,16 @@ client_geometry_hints(client_t *c, area_t geometry)
{
if(ratio < min)
{
dy = (dx * min + dy) / (min * min + 1);
dx = dy * min;
/* dx is lower than allowed, make dy lower to compensate this
* (+ 0.5 to force proper rounding). */
dy = dx / min + 0.5;
geometry.width = (int) dx + real_basew;
geometry.height = (int) dy + real_baseh;
}
else if(ratio > max)
{
dy = (dx * min + dy) / (max * max + 1);
dx = dy * min;
/* dx is too high, lower it (+0.5 for proper rounding) */
dx = dy * max + 0.5;
geometry.width = (int) dx + real_basew;
geometry.height = (int) dy + real_baseh;
}