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:
parent
227b71921d
commit
9977802d7e
9
client.c
9
client.c
|
@ -818,15 +818,16 @@ client_geometry_hints(client_t *c, area_t geometry)
|
||||||
{
|
{
|
||||||
if(ratio < min)
|
if(ratio < min)
|
||||||
{
|
{
|
||||||
dy = (dx * min + dy) / (min * min + 1);
|
/* dx is lower than allowed, make dy lower to compensate this
|
||||||
dx = dy * min;
|
* (+ 0.5 to force proper rounding). */
|
||||||
|
dy = dx / min + 0.5;
|
||||||
geometry.width = (int) dx + real_basew;
|
geometry.width = (int) dx + real_basew;
|
||||||
geometry.height = (int) dy + real_baseh;
|
geometry.height = (int) dy + real_baseh;
|
||||||
}
|
}
|
||||||
else if(ratio > max)
|
else if(ratio > max)
|
||||||
{
|
{
|
||||||
dy = (dx * min + dy) / (max * max + 1);
|
/* dx is too high, lower it (+0.5 for proper rounding) */
|
||||||
dx = dy * min;
|
dx = dy * max + 0.5;
|
||||||
geometry.width = (int) dx + real_basew;
|
geometry.width = (int) dx + real_basew;
|
||||||
geometry.height = (int) dy + real_baseh;
|
geometry.height = (int) dy + real_baseh;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue