From 26f494edb0ad7978ab04eb41d2293e26c50e5451 Mon Sep 17 00:00:00 2001 From: Jonas Ådahl Date: Mon, 13 Jan 2020 19:07:49 +0100 Subject: xdg-shell: Add support for explicit popup repositioning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds protocol additions making it possible to request that a popup should be repositioned according to a new xdg_positioner object. Explicit popup moving is done using a new request on xdg_popup: xdg_popup.reposition. What it does is change the parameters used for positioning a popup by providing a new xdg_positioner object. This request is coupled with a new event; xdg_popup.repositioned, sent together with the configure events (xdg_popup.configure and xdg_surface.configure) to notify about the completion of the reposition request. The reposition request also takes a token that is later passed via the repositioned event; this is done so that a client may determine for which reposition request the compositor has sent configure events. Synchronization between surfaces to avoid state application race condition are deliberately left out, and should be handled by an external protocol. To brief the compositor of the future dimension of the parent that the compositor should position the popup against, a xdg_positioner.set_parent_size request is added. Lastly, a request to couple a xdg_positioner object with a parent configure event is added (xdg_positioner.set_parent_configure) in order for a compositor to pair a popup reposition request with a pending configure event, and it's resulting window geometry. This is necessary to, for example, properly constrain a popup given a future parent state. An example of when this may be necessary is an interactive resize where both the toplevel position and the relative popup position changes. Signed-off-by: Jonas Ådahl Reviewed-by: Mike Blumenkrantz Reviewed-by: Simon Ser --- stable/xdg-shell/xdg-shell.xml | 82 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) (limited to 'stable') diff --git a/stable/xdg-shell/xdg-shell.xml b/stable/xdg-shell/xdg-shell.xml index a3ab57b..be64354 100644 --- a/stable/xdg-shell/xdg-shell.xml +++ b/stable/xdg-shell/xdg-shell.xml @@ -370,6 +370,33 @@ xdg_surface.configure event. + + + + Set the parent window geometry the compositor should use when + positioning the popup. The compositor may use this information to + determine the future state the popup should be constrained using. If + this doesn't match the dimension of the parent the popup is eventually + positioned against, the behavior is undefined. + + The arguments are given in the surface-local coordinate space. + + + + + + + + Set the serial of a xdg_surface.configure event this positioner will be + used in response to. The compositor may use this information together + with set_parent_size to determine what future state the popup should be + constrained using. + + + @@ -1138,7 +1165,7 @@ 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. + set_reactive requested, or in response to xdg_popup.reposition requests. @@ -1156,5 +1183,58 @@ + + + + + Reposition an already-mapped popup. The popup will be placed given the + details in the passed xdg_positioner object, and a + xdg_popup.repositioned followed by xdg_popup.configure and + xdg_surface.configure will be emitted in response. Any parameters set + by the previous positioner will be discarded. + + The passed token will be sent in the corresponding + xdg_popup.repositioned event. The new popup position will not take + effect until the corresponding configure event is acknowledged by the + client. See xdg_popup.repositioned for details. The token itself is + opaque, and has no other special meaning. + + If multiple reposition requests are sent, the compositor may skip all + but the last one. + + If the popup is repositioned in response to a configure event for its + parent, the client should send an xdg_positioner.set_parent_configure + and possibly a xdg_positioner.set_parent_size request to allow the + compositor to properly constrain the popup. + + If the popup is repositioned together with a parent that is being + resized, but not in response to a configure event, the client should + send a xdg_positioner.set_parent_size request. + + + + + + + + The repositioned event is sent as part of a popup configuration + sequence, together with xdg_popup.configure and lastly + xdg_surface.configure to notify the completion of a reposition request. + + The repositioned event is to notify about the completion of a + xdg_popup.reposition request. The token argument is the token passed + in the xdg_popup.reposition request. + + Immediately after this event is emitted, xdg_popup.configure and + xdg_surface.configure will be sent with the updated size and position, + as well as a new configure serial. + + The client should optionally update the content of the popup, but must + acknowledge the new popup configuration for the new position to take + effect. See xdg_surface.ack_configure for details. + + + + -- cgit v1.2.3