[PATCH] tweak rounding on weston-terminal resize

Pekka Paalanen ppaalanen at gmail.com
Thu Apr 4 09:33:56 PDT 2013


On Thu,  4 Apr 2013 11:00:50 -0400
Jason Woofenden <jason at jasonwoof.com> wrote:

> ---
>  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

Looks good to me.

We usually prefix the commit subject with a tag, like:
"terminal: tweak rounding on resize"

You could have also explained in the commit message body, why this
is a useful change.


Thanks,
pq


More information about the wayland-devel mailing list