[PATCH] tweak rounding on weston-terminal resize

Kristian Høgsberg hoegsberg at gmail.com
Thu Apr 4 09:48:04 PDT 2013


On Thu, Apr 04, 2013 at 11:00:50AM -0400, Jason Woofenden 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

Missing semicolong here, doesn't compile.  Aside from that I don't
agree with this change: the window now expands ahead of the pointer,
which is pretty unusual.  Also, clients should generally not adjust
the configure width and height to be bigger than the suggested size,
always adjust down.  The exception is the case where you're hitting a
minimum size for your window.

Kristian

> +	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
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list