xdg-shell: Add resize_x/y constraint adjustment to positioner

In order to get feedback of available space where a client can create
its popup, let it create requset that its popup rectangle being resized
would it not fit the within the work area. This adds two new constraint
adjustment values to the adjustment enum, and dimension parameters to
the xdg_popup.configure event.

The existing constraint adjustment actions take precedence, and resizing
will only be triggered if all other adjustments requested didn't manage
to make the popup rectangle fully visible.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Jonas Ådahl 2016-07-15 16:55:51 +08:00
parent 7ba6a6ab15
commit c09e89929b

View file

@ -234,6 +234,20 @@
</request> </request>
<enum name="constraint_adjustment" bitfield="true"> <enum name="constraint_adjustment" bitfield="true">
<description summary="constraint adjustments">
The constraint adjustment value define ways the compositor will adjust
the position of the surface, if the unadjusted position would result
in the surface being partly constrained.
Whether a surface is considered 'constrained' is left to the compositor
to determine. For example, the surface may be partly outside the
compositor's defined 'work area', thus necessitating the child surface's
position be adjusted until it is entirely inside the work area.
The adjustments can be combined, according to a defined precedence: 1)
Flip, 2) Slide, 3) Resize.
</description>
<entry name="none" value="0"> <entry name="none" value="0">
<description summary="don't move the child surface when constrained"> <description summary="don't move the child surface when constrained">
Don't alter the surface position even if it is constrained on some Don't alter the surface position even if it is constrained on some
@ -253,8 +267,6 @@
x axis until either the edge in the direction of the gravity is x axis until either the edge in the direction of the gravity is
unconstrained or the edge in the opposite direction of the gravity is unconstrained or the edge in the opposite direction of the gravity is
constrained. constrained.
If 'slide_x' is combined with 'flip_x', 'flip_x' takes precedence.
</description> </description>
</entry> </entry>
<entry name="slide_y" value="2"> <entry name="slide_y" value="2">
@ -270,8 +282,6 @@
y axis until either the edge in the direction of the gravity is y axis until either the edge in the direction of the gravity is
unconstrained or the edge in the opposite direction of the gravity is unconstrained or the edge in the opposite direction of the gravity is
constrained. constrained.
If 'slide_y' is combined with 'flip_y', 'flip_y' takes precedence.
</description> </description>
</entry> </entry>
<entry name="flip_x" value="4"> <entry name="flip_x" value="4">
@ -282,9 +292,8 @@
'left', change the gravity to 'right' and the anchor to 'right'. 'left', change the gravity to 'right' and the anchor to 'right'.
If the adjusted position also ends up being constrained, the resulting If the adjusted position also ends up being constrained, the resulting
position will be the one before the adjustment. If the resulting position of the flip_x adjustment will be the one before the
position is still constrained, and 'flip_x' is combined with adjustment.
'slide_x', the position is adjusted according to 'slide_x'.
</description> </description>
</entry> </entry>
<entry name="flip_y" value="8"> <entry name="flip_y" value="8">
@ -295,9 +304,19 @@
'bottom', change the gravity to 'top' and the anchor to 'top'. 'bottom', change the gravity to 'top' and the anchor to 'top'.
If the adjusted position also ends up being constrained, the resulting If the adjusted position also ends up being constrained, the resulting
position will be the one before the adjustment. If the resulting position of the flip_y adjustment will be the one before the
position is still constrained, and 'flip_y' is combined with adjustment.
'slide_y', the position is adjusted according to 'slide_y'. </description>
</entry>
<entry name="resize_x" value="16">
<description summary="horizontally resize the surface">
Resize the surface horizontally so that it is completely
unconstrained.
</description>
</entry>
<entry name="resize_y" value="32">
<description summary="vertically resize the surface">
Resize the surface vertically so that it is completely unconstrained.
</description> </description>
</entry> </entry>
</enum> </enum>
@ -1010,6 +1029,8 @@
summary="x position relative to parent surface window geometry"/> summary="x position relative to parent surface window geometry"/>
<arg name="y" type="int" <arg name="y" type="int"
summary="y position relative to parent surface window geometry"/> summary="y position relative to parent surface window geometry"/>
<arg name="width" type="int" summary="window geometry width"/>
<arg name="height" type="int" summary="window geometry height"/>
</event> </event>
<event name="popup_done"> <event name="popup_done">