openbsd-ports/x11/i3/patches/patch-src_render_c
dcoppa 059168ee8f Bunch of fixes from upstream:
Fix crash when not having tray_output configured

libi3: mark IPC fd CLOEXEC

Ensure that resize will take place even if pixel is smaller than
size increments

Fix floating window size with hide_edge_borders

render_con: fix height rounding in aspect ratio computation

tabbed: floor(), put extra pixels into the last tab
2013-05-17 10:21:42 +00:00

56 lines
2.3 KiB
Plaintext

$OpenBSD: patch-src_render_c,v 1.3 2013/05/17 10:21:42 dcoppa Exp $
commit b7da2dbcd87fbb167f2e76c113e7289564375c3f
Author: Clement Boesch <ubitux@gmail.com>
Date: Sat Apr 20 23:47:37 2013 +0200
render_con: fix height rounding in aspect ratio computation
With a 484x292 window and proportion of 488x294, new_height is
291.590164 after the loop, causing a rounding issue leading to
a window of 484x291.
commit 9f353996feb8ebab74ca747d319dd3c6746afca7
Author: Michael Stapelberg <michael@stapelberg.de>
Date: Sun Apr 7 09:58:34 2013 +0200
tabbed: floor(), put extra pixels into the last tab
This is the only sane way I can think of to deal with the problem
that the screen size may not be dividable by the amount of tabbed
children (e.g. 1280 / 41 = 31.219512_).
--- src/render.c.orig Mon Mar 18 22:43:36 2013
+++ src/render.c Fri May 17 11:51:32 2013
@@ -184,10 +184,10 @@ void render_con(Con *con, bool render_fullscreen) {
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;
}
@@ -372,9 +372,15 @@ void render_con(Con *con, bool render_fullscreen) {
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;