[PATCH weston] libweston-desktop: fix the size of unmaximized xdg surfaces

Quentin Glidic sardemff7+wayland at sardemff7.net
Thu Jul 27 13:22:49 UTC 2017


On 7/27/17 3:01 PM, Giulio Camuffo wrote:
> When unmaximizing a surface the configure event should send 0,0 as the
> requested size, so that the client can use the size that it had before
> maximizing

Hi,

I disagree on this patch for a few reasons:
- the size can be ignored in this case, so there is no harm in keeping 
it non-0
- it’s up to the shell/compositor to decide, not a protocol library
- I am working on a not-so-tiny rewrite of the state code, based on the 
size_requested patch, that will make it clear that the shell/compositor 
is in charge here

What do you think?

Cheers,


> ---
>   libweston-desktop/xdg-shell-v6.c | 31 ++++++++++++++++++-------------
>   1 file changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/libweston-desktop/xdg-shell-v6.c b/libweston-desktop/xdg-shell-v6.c
> index 1344dda0..3a02815f 100644
> --- a/libweston-desktop/xdg-shell-v6.c
> +++ b/libweston-desktop/xdg-shell-v6.c
> @@ -578,11 +578,29 @@ weston_desktop_xdg_toplevel_send_configure(struct weston_desktop_xdg_toplevel *t
>   };
>   
>   static void
> +weston_desktop_xdg_toplevel_set_size(struct weston_desktop_surface *dsurface,
> +				     void *user_data,
> +				     int32_t width, int32_t height)
> +{
> +	struct weston_desktop_xdg_toplevel *toplevel = user_data;
> +
> +	toplevel->pending.size.width = width;
> +	toplevel->pending.size.height = height;
> +
> +	weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false);
> +}
> +
> +static void
>   weston_desktop_xdg_toplevel_set_maximized(struct weston_desktop_surface *dsurface,
>   					  void *user_data, bool maximized)
>   {
>   	struct weston_desktop_xdg_toplevel *toplevel = user_data;
>   
> +	/* if we're unmaximizing set the size to 0 so that when the configure event is sent
> +	   it will tell the client to use the size it wants */
> +	if (toplevel->pending.state.maximized && !maximized)
> +		weston_desktop_xdg_toplevel_set_size(dsurface, toplevel, 0, 0);
> +
>   	toplevel->pending.state.maximized = maximized;
>   	weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false);
>   }
> @@ -618,19 +636,6 @@ weston_desktop_xdg_toplevel_set_activated(struct weston_desktop_surface *dsurfac
>   }
>   
>   static void
> -weston_desktop_xdg_toplevel_set_size(struct weston_desktop_surface *dsurface,
> -				     void *user_data,
> -				     int32_t width, int32_t height)
> -{
> -	struct weston_desktop_xdg_toplevel *toplevel = user_data;
> -
> -	toplevel->pending.size.width = width;
> -	toplevel->pending.size.height = height;
> -
> -	weston_desktop_xdg_surface_schedule_configure(&toplevel->base, false);
> -}
> -
> -static void
>   weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplevel,
>   				      int32_t sx, int32_t sy)
>   {
> 


-- 

Quentin “Sardem FF7” Glidic


More information about the wayland-devel mailing list