[PATCH v3] xdg-shell: add preferred min/max size requests

Olivier Fourdan ofourdan at redhat.com
Thu Apr 7 06:56:54 UTC 2016


Some application may wish to restrict their window in size, but
xdg-shell has no mechanism for the client to advertise such a maximum
or minimum size the compositor can use.

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_preferred_max_size" and "set_preferred_min_size"
to xdg-shell so that the client can tell the compositor which would be
its preferred smallest/largest acceptable size, so that he compositor
can decide if maximize or fullscreen makes sense, draw an accurate
animation, etc.

Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
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
 
 unstable/xdg-shell/xdg-shell-unstable-v5.xml | 62 ++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/unstable/xdg-shell/xdg-shell-unstable-v5.xml b/unstable/xdg-shell/xdg-shell-unstable-v5.xml
index 542491f..6e7fa6e 100644
--- a/unstable/xdg-shell/xdg-shell-unstable-v5.xml
+++ b/unstable/xdg-shell/xdg-shell-unstable-v5.xml
@@ -462,6 +462,68 @@
       <arg name="height" type="int"/>
     </request>
 
+    <request name="set_preferred_max_size">
+      <description summary="set the preferred maximum size">
+        Set a preferred maximum size for the surface.
+
+        The client can specify a preferred maximum size to tell the
+        compositor that a surface should not be resized beyond this
+        size.
+
+        The compositor may use this information from the client to allow
+        or disallow different states like maximixe or fullscreen and
+        draw accurate animations.
+
+        Similarily, a tiling window manager can use this information to
+        place and resize client windows in a more effective way.
+
+        If never set, the size of the surface is not limited by the client.
+
+        A value of zero in the request for either width, height or both
+        means that the client has no preference regarding the minimum size
+        in the given dimension. As a result, a client wishing to reset the
+        preferred minimum size to an unspecified state can use zero for
+        width and height in the request.
+
+        The values provided by the client are unscaled, the compositor
+        needs to apply the relevant scale for the surface for its own
+        size computations.
+      </description>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+    </request>
+
+    <request name="set_preferred_min_size">
+      <description summary="set the preferred minimum size">
+        Set a preferred minimum size for the surface.
+
+        The client can specify a preferred minimum size to tell the
+        compositor that a surface should not be resized below this
+        size.
+
+        The compositor may use this information from the client to allow
+        or disallow different states like maximixe or fullscreen and
+        draw accurate animations.
+
+        Similarily, a tiling window manager can use this information to
+        place and resize client windows in a more effective way.
+
+        If never set, the size of the surface is not limited by the client.
+
+        A value of zero in the request for either width, height or both
+        means that the client has no preference regarding the maximum size
+        in the given dimension. As a result, a client wishing to reset the
+        preferred maximum size to an unspecified state can use zero for
+        width and height in the request.
+
+        The values provided by the client are unscaled, the compositor
+        needs to apply the relevant scale for the surface for its own
+        size computations.
+      </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