[PATCH] tweak rounding on weston-terminal resize

Jason Woofenden jason at jasonwoof.com
Thu Apr 4 08:00:50 PDT 2013


---
 clients/terminal.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/clients/terminal.c b/clients/terminal.c
index e80e0e5..81edd25 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -757,11 +757,13 @@ resize_handler(struct widget *widget,
 	       int32_t width, int32_t height, void *data)
 {
 	struct terminal *terminal = data;
-	int32_t columns, rows, m;
+	int32_t columns, rows, m, cell_w, cell_h;
 
 	m = 2 * terminal->margin;
-	columns = (width - m) / (int32_t) terminal->extents.max_x_advance;
-	rows = (height - m) / (int32_t) terminal->extents.height;
+	cell_w = (int32_t) terminal->extents.max_x_advance;
+	cell_h = (int32_t) terminal->extents.height
+	columns = (width - m + (cell_w / 2)) / cell_w;
+	rows = (height - m + (cell_h / 2)) / cell_h;
 
 	if (!window_is_fullscreen(terminal->window) &&
 	    !window_is_maximized(terminal->window)) {
-- 
1.7.10.4



More information about the wayland-devel mailing list