Fix aspect ratio bugs

- ICCCM says: > If a base size is not provided, the minimum size is to
be used in its place and vice versa.
i3 didn't obey the "vice versa" part. Min size and base size are both
saved without replacements in window_update_normal_hints,
floating_check_size makes the needed replacements if either was not
provided.
- Aspect ratio is now saved correctly in manage_window because
window_update_normal_hints is called.
- i3 didn't save the aspect ratio if the window conformed the given
aspect ratio range when handle_normal_hints was called. If the window
was resized to a size outside of the given bounds, i3 didn't correct it.
- Aspect ratio now affects only tiling windows, like the rest of the
normal size hints
- The aspect ratio calculation is now done without a loop

A real life example of how these changes affect the workflow:
An mpv window, when playing a video, sets its min == max aspect ratio
during mapping. i3 ignored these hints. When resized, the window's
aspect ratio was not preserved. With this commit, resizing floating mpv
windows will always preserve the aspect ratio.
This commit is contained in:
Orestis Floros
2018-10-01 19:47:33 +03:00
parent f397698d43
commit 29f2510fa9
13 changed files with 304 additions and 228 deletions

View File

@ -467,7 +467,7 @@ static void cmd_resize_floating(I3_CMD, const char *way, const char *direction_s
} else {
floating_con->rect.width += px;
}
floating_check_size(floating_con);
floating_check_size(floating_con, orientation == VERT);
/* Did we actually resize anything or did the size constraints prevent us?
* If we could not resize, exit now to not move the window. */