Store aspect_ratio instead of weird proportional_{width,height} (Thanks phillip)
This commit only goes to “next” because I am not sure whether it actually makes things better in all cases and want to give it some testing first. There was no documented reason behind using the proportional_{width,height} variables, so I suppose that code was just stupidity on my part (it was written merely a month after I started this project in 2009). fixes #1032
This commit is contained in:
@ -799,22 +799,18 @@ static bool handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t stat
|
||||
goto render_and_return;
|
||||
|
||||
/* Check if we need to set proportional_* variables using the correct ratio */
|
||||
double aspect_ratio = 0.0;
|
||||
if ((width / height) < min_aspect) {
|
||||
if (con->proportional_width != width ||
|
||||
con->proportional_height != (width / min_aspect)) {
|
||||
con->proportional_width = width;
|
||||
con->proportional_height = width / min_aspect;
|
||||
changed = true;
|
||||
}
|
||||
aspect_ratio = min_aspect;
|
||||
} else if ((width / height) > max_aspect) {
|
||||
if (con->proportional_width != width ||
|
||||
con->proportional_height != (width / max_aspect)) {
|
||||
con->proportional_width = width;
|
||||
con->proportional_height = width / max_aspect;
|
||||
changed = true;
|
||||
}
|
||||
aspect_ratio = max_aspect;
|
||||
} else goto render_and_return;
|
||||
|
||||
if (fabs(con->aspect_ratio - aspect_ratio) > DBL_EPSILON) {
|
||||
con->aspect_ratio = aspect_ratio;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
render_and_return:
|
||||
if (changed)
|
||||
tree_render();
|
||||
|
Reference in New Issue
Block a user