[PATCH v8 xdg-shell-unstable-v6] xdg-shell: Add min/max size requests

Jonas Ådahl jadahl at gmail.com
Tue Apr 19 01:00:29 UTC 2016


On Mon, Apr 18, 2016 at 09:19:48AM +0200, Olivier Fourdan wrote:
> Some application may wish to restrict their window in size, but
> xdg-shell has no mechanism for the client to specify a maximum or
> minimum size.
> 
> As a result, the compositor may try to maximize or fullscreen a window
> while the client would not allow for the requested size.
> 
> Add new requests "set_max_size" and "set_min_size" to xdg-shell so that
> the client can tell the compositor what would be its smallest/largest
> acceptable size, and that the compositor can decide if maximize or
> fullscreen is achievable, draw an accurate animation, etc.
> 
> Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>

Reviewed-by: Jonas Ådahl <jadahl at gmail.com> with one nit below. If
everyone is fine with the semantics with this version, I'll go ahead and
merge this to the wip/xdg-shell-unstable-v6 branch.

> Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=764413
> ---
>  v2: Rename the request to "set_preferred_max_size",
>      add "set_preferred_min_size" as well
>  v3: Rebase above patch 72427 in branch xdg-shell-unstable-v6
>      Rephrase description to clarify the unscaled size and using 0 to
>      reset back the preferred size to an unspecified state
>  v4: Patch the correct xml file (v6, not v5 <facepalm>)
>      Fix multiple mismatch of min/max in the description
>      Remove mention of "unscaled", specify window geometry coordinates
>      and refer to set_window_geometry.
>  v5: Fix typos and remove "preferred" from the name and description as
>      requested by several people on the ML and irc.
>  v6: Specify the requests are double-buffered and require a commit,
>      rephrase the values never set as suggested by Jasper, state
>      that min > max is an invalid state and result in a protocol error
>      as suggested by Bill, Yong and Jonas.
>  v7: Specify that width/height values must be greater than or equal to
>      zero as discussed with Mike.
>  v8: Explicitely state that the compositor may ignore the mix/max size.
> 
>  unstable/xdg-shell/xdg-shell-unstable-v6.xml | 88 ++++++++++++++++++++++++++++
>  1 file changed, 88 insertions(+)
> 
> diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> index 3fc7d42..1448c2c 100644
> --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml
> @@ -489,6 +489,94 @@
>        <arg name="states" type="array"/>
>      </event>
>  
> +    <request name="set_max_size">
> +      <description summary="set the maximum size">
> +	Set a maximum size for the window.
> +
> +	The client can specify a maximum size so that the compositor does
> +	not try to configure the window beyond this size.
> +
> +	The width and height arguments are in window geometry coordinates.
> +	See set_window_geometry.
> +
> +	Values set in this way are double-buffered. They will get applied
> +	on the next commit.
> +
> +	The compositor can use this information to allow or disallow
> +	different states like maximize or fullscreen and draw accurate
> +	animations.
> +
> +	Similarly, a tiling window manager may use this information to
> +	place and resize client windows in a more effective way.
> +
> +	The client should not rely on the compositor to obey the maximum
> +	size. The compositor may decide to ignore the values set by the
> +	client and request a larger size. In such a case, the client can
> +	either adapt to the requested size or refuse to acknowledge the
> +	configure event sent by the compositor. See xdg_surface.configure
> +	and xdg_surface.ack_configure for details.

Can probably remove everything after ".. the value set by the client
and request a larger size." since it goes on to try to describe the
configure event semantics. Not sure they are entirely correctly spelled
out here, so to avoid stalling this patch even further, I suggest to
drop this part (and the same for set_min_size).


Jonas

> +
> +	If never set, or a value of zero in the request, means that the
> +	client has no expected maximum size in the given dimension.
> +	As a result, a client wishing to reset the maximum size
> +	to an unspecified state can use zero for width and height in the
> +	request.
> +
> +	Requesting a maximum size to be smaller than the minimum size of
> +	a surface is illegal and will result in a protocol error.
> +
> +	The width and height must be greater than or equal to zero. Using
> +	strictly negative values for width and height will result in a
> +	protocol error.
> +      </description>
> +      <arg name="width" type="int"/>
> +      <arg name="height" type="int"/>
> +    </request>
> +
> +    <request name="set_min_size">
> +      <description summary="set the minimum size">
> +	Set a minimum size for the window.
> +
> +	The client can specify a minimum size so that the compositor does
> +	not try to configure the window below this size.
> +
> +	The width and height arguments are in window geometry coordinates.
> +	See set_window_geometry.
> +
> +	Values set in this way are double-buffered. They will get applied
> +	on the next commit.
> +
> +	The compositor can use this information to allow or disallow
> +	different states like maximize or fullscreen and draw accurate
> +	animations.
> +
> +	Similarly, a tiling window manager may use this information to
> +	place and resize client windows in a more effective way.
> +
> +	The client should not rely on the compositor to obey the minimum
> +	size. The compositor may decide to ignore the values set by the
> +	client and request a smaller size. In such a case, the client can
> +	either adapt to the requested size or refuse to acknowledge the
> +	configure event sent by the compositor. See xdg_surface.configure
> +	and xdg_surface.ack_configure for details.
> +
> +	If never set, or a value of zero in the request, means that the
> +	client has no expected minimum size in the given dimension.
> +	As a result, a client wishing to reset the minimum size
> +	to an unspecified state can use zero for width and height in the
> +	request.
> +
> +	Requesting a minimum size to be larger than the maximum size of
> +	a surface is illegal and will result in a protocol error.
> +
> +	The width and height must be greater than or equal to zero. Using
> +	strictly negative values for width and height will result in a
> +	protocol error.
> +      </description>
> +      <arg name="width" type="int"/>
> +      <arg name="height" type="int"/>
> +    </request>
> +
>      <request name="set_maximized">
>        <description summary="maximize the window">
>  	Maximize the surface.
> -- 
> 2.5.5
> 


More information about the wayland-devel mailing list