[weston v2 5/8] xwm: Make sure we respect the window's size hints

Quentin Glidic sardemff7+wayland at sardemff7.net
Mon Nov 13 21:44:35 UTC 2017


On 11/13/17 10:20 PM, Louis-Francis Ratté-Boulianne wrote:
> Don't just ignore the minimal and maximal sizes requested
> by the application.
> 
> Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
> ---
>   xwayland/window-manager.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
> index 3cc6fa24..a0ff6b62 100644
> --- a/xwayland/window-manager.c
> +++ b/xwayland/window-manager.c
> @@ -2801,6 +2801,20 @@ send_configure(struct weston_surface *surface, int32_t width, int32_t height)
>   	else
>   		new_height = 1;
>   
> +	/* Make sure we respect the window's size hints */
> +	if (window->size_hints.min_width > 0 &&
> +	    new_width < window->size_hints.min_width)
> +		new_width = window->size_hints.min_width;
> +	if (window->size_hints.min_height > 0 &&
> +	    new_height < window->size_hints.min_height)
> +		new_height = window->size_hints.min_height;
> +	if (window->size_hints.max_width > 0 &&
> +	    new_width > window->size_hints.max_width)
> +		new_width = window->size_hints.max_width;
> +	if (window->size_hints.max_height > 0 &&
> +	    new_height > window->size_hints.max_height)
> +		new_height = window->size_hints.max_height;
> +
>   	if (window->width == new_width && window->height == new_height)
>   		return;
>   
> 

This one is wrong. Ultimately, it’s up to the shell to decide.
We should forward these hints to libweston-desktop that will provide 
them just like xdg_shell min/max size.
If the shell decide to configure a size outside these hints, it’s up to 
it. A tiling compositor could also use it to e.g. not expand a tile too 
much and expand the other tiles instead.

Thanks,


-- 

Quentin “Sardem FF7” Glidic


More information about the wayland-devel mailing list