* Ignoring aspect ratio during fullscreen was necessary to fix MPlayer
* subtitle rendering, see http://bugs.i3wm.org/594 */
if (!render_fullscreen &&
- con->proportional_height != 0 &&
- con->proportional_width != 0) {
+ con->aspect_ratio > 0.0) {
+ DLOG("aspect_ratio = %f, current width/height are %d/%d\n",
+ con->aspect_ratio, inset->width, inset->height);
double new_height = inset->height + 1;
int new_width = inset->width;
while (new_height > inset->height) {
- new_height = ((double)con->proportional_height / con->proportional_width) * new_width;
+ new_height = (1.0 / con->aspect_ratio) * new_width;
if (new_height > inset->height)
new_width--;
}
/* Center the window */
- inset->y += ceil(inset->height / 2) - floor(new_height / 2);
+ inset->y += ceil(inset->height / 2) - floor((new_height + .5) / 2);
inset->x += ceil(inset->width / 2) - floor(new_width / 2);
- inset->height = new_height;
+ inset->height = new_height + .5;
inset->width = new_width;
}
child->rect.width = rect.width;
child->rect.height = rect.height;
- child->deco_rect.width = ceil((float)child->rect.width / children);
+ child->deco_rect.width = floor((float)child->rect.width / children);
child->deco_rect.x = x - con->rect.x + i * child->deco_rect.width;
child->deco_rect.y = y - con->rect.y;
+ /* Since the tab width may be something like 31,6 px per tab, we
+ * let the last tab have all the extra space (0,6 * children). */
+ if (i == (children-1)) {
+ child->deco_rect.width += (child->rect.width - (child->deco_rect.x + child->deco_rect.width));
+ }
+
if (children > 1 || (child->border_style != BS_PIXEL && child->border_style != BS_NONE)) {
child->rect.y += deco_height;
child->rect.height -= deco_height;