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
528747267a
commit
5bfe0f69d1
|
@ -606,15 +606,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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue