Skip to content

Commit

Permalink
xdg-shell: Add support for implicit popup repositioning
Browse files Browse the repository at this point in the history
This commit adds protocol additions making it possible to implicitly
reposition an already mapped popup if the conditions for the constraint
changed (e.g. toplevel moved).

Implicit popup moving is done by setting a adjustment flag on the
positioner used to create it that will cause the compositor to adjust
the position as the conditions used to constrain it change.

These changes may include, for example, changes in the position of the
parent window or the geometry of the work area. To allow the client to
update its content in response to the updated position, the client must
ack the configure event, optionally with new content. Until the client
acks this configure event, the existing positioner will continue to be
used.

Implicit repositioning by itself is racy regarding inter-surface
synchronization of applied state. Inter-surface synchronization is
deliberately left out of xdg-shell, and left to be handled externally.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
  • Loading branch information
jadahl committed Feb 29, 2020
1 parent 2b0c87e commit ebbad29
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions stable/xdg-shell/xdg-shell.xml
Expand Up @@ -29,7 +29,7 @@
DEALINGS IN THE SOFTWARE.
</copyright>

<interface name="xdg_wm_base" version="2">
<interface name="xdg_wm_base" version="3">
<description summary="create desktop-style surfaces">
The xdg_wm_base interface is exposed as a global object enabling clients
to turn their wl_surfaces into windows in a desktop environment. It
Expand Down Expand Up @@ -115,7 +115,7 @@
</event>
</interface>

<interface name="xdg_positioner" version="2">
<interface name="xdg_positioner" version="3">
<description summary="child surface positioner">
The xdg_positioner provides a collection of rules for the placement of a
child surface relative to a parent surface. Rules can be defined to ensure
Expand Down Expand Up @@ -357,9 +357,22 @@
<arg name="x" type="int" summary="surface position x offset"/>
<arg name="y" type="int" summary="surface position y offset"/>
</request>

<!-- Version 3 additions -->

<request name="set_reactive" since="3">
<description summary="continuously reconstrain the surface">
When set reactive, the surface is reconstrained if the conditions used
for constraining changed, e.g. the parent window moved.

If the conditions changed and the popup was reconstrained, an
xdg_popup.configure event is sent with updated geometry, followed by an
xdg_surface.configure event.
</description>
</request>
</interface>

<interface name="xdg_surface" version="2">
<interface name="xdg_surface" version="3">
<description summary="desktop user interface surface base interface">
An interface that may be implemented by a wl_surface, for
implementations that provide a desktop-style user interface.
Expand Down Expand Up @@ -526,9 +539,10 @@
</description>
<arg name="serial" type="uint" summary="serial of the configure event"/>
</event>

</interface>

<interface name="xdg_toplevel" version="2">
<interface name="xdg_toplevel" version="3">
<description summary="toplevel surface">
This interface defines an xdg_surface role which allows a surface to,
among other things, set window-like properties such as maximize,
Expand Down Expand Up @@ -1019,7 +1033,7 @@
</event>
</interface>

<interface name="xdg_popup" version="2">
<interface name="xdg_popup" version="3">
<description summary="short-lived, popup surfaces for menus">
A popup surface is a short-lived, temporary surface. It can be used to
implement for example menus, popovers, tooltips and other similar user
Expand Down Expand Up @@ -1120,6 +1134,11 @@
The x and y arguments represent the position the popup was placed at
given the xdg_positioner rule, relative to the upper left corner of the
window geometry of the parent surface.

For version 2 or older, the configure event for an xdg_popup is only
ever sent once for the initial configuration. Starting with version 3,
it may be sent again if the popup is setup with an xdg_positioner with
set_reactive requested.
</description>
<arg name="x" type="int"
summary="x position relative to parent surface window geometry"/>
Expand Down

0 comments on commit ebbad29

Please sign in to comment.