[PATCH 06/16] xdg-shell: Implement set_transient_for request.
Kristian Høgsberg
hoegsberg at gmail.com
Fri Nov 29 15:39:08 PST 2013
On Wed, Nov 27, 2013 at 03:50:22PM -0200, Rafael Antognolli wrote:
> The implementation just sets a parent/child relationship between the
> xdg_surface and its parent, passed as argument of this request. Stacking
> might be affected (that's up to the compositor).
>
> This implementation does not affect the code that handles the previous
> transient surface type. It should still work as expected, but it's not
> possible to set that surface type to a xdg_surface.
> ---
> src/shell.c | 50 +++++++++++++++++++++++++++++---------------------
> 1 file changed, 29 insertions(+), 21 deletions(-)
>
> diff --git a/src/shell.c b/src/shell.c
> index 6cbb4bd..98fb0fe 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -2955,6 +2955,18 @@ xdg_surface_destroy(struct wl_client *client,
> }
>
> static void
> +xdg_surface_set_transient_for(struct wl_client *client,
> + struct wl_resource *resource,
> + struct wl_resource *parent_resource)
> +{
> + struct shell_surface *shsurf = wl_resource_get_user_data(resource);
> + struct weston_surface *parent =
> + wl_resource_get_user_data(parent_resource);
> +
> + shsurf->parent = parent;
> +}
> +
> +static void
> xdg_surface_pong(struct wl_client *client,
> struct wl_resource *resource,
> uint32_t serial)
> @@ -3078,7 +3090,7 @@ xdg_surface_unset_maximized(struct wl_client *client,
>
> static const struct xdg_surface_interface xdg_surface_implementation = {
> xdg_surface_destroy,
> - NULL, // set_transient_for
> + xdg_surface_set_transient_for,
> xdg_surface_set_title,
> xdg_surface_set_app_id,
> xdg_surface_pong,
> @@ -4567,27 +4579,23 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf,
> }
>
> /* surface stacking order, see also activate() */
> - switch (shsurf->type) {
> - case SHELL_SURFACE_POPUP:
> - case SHELL_SURFACE_TRANSIENT:
> - /* TODO: Handle a parent with multiple views */
> - parent = get_default_view(shsurf->parent);
> - if (parent) {
> - wl_list_remove(&shsurf->view->layer_link);
> - wl_list_insert(parent->layer_link.prev,
> - &shsurf->view->layer_link);
> + if (shsurf->type != SHELL_SURFACE_NONE) {
> + if (shsurf->parent) {
> + /* TODO: Handle a parent with multiple views */
> + parent = get_default_view(shsurf->parent);
> + if (parent) {
> + wl_list_remove(&shsurf->view->layer_link);
> + wl_list_insert(parent->layer_link.prev,
> + &shsurf->view->layer_link);
> + }
> + } else {
> + if (!shsurf->cur.fullscreen) {
> + ws = get_current_workspace(shell);
> + wl_list_remove(&shsurf->view->layer_link);
> + wl_list_insert(&ws->layer.view_list,
> + &shsurf->view->layer_link);
> + }
> }
> - break;
> - case SHELL_SURFACE_NONE:
> - break;
> - case SHELL_SURFACE_XWAYLAND:
> - default:
> - if (shsurf->cur.fullscreen)
> - break;
> - ws = get_current_workspace(shell);
> - wl_list_remove(&shsurf->view->layer_link);
> - wl_list_insert(&ws->layer.view_list, &shsurf->view->layer_link);
> - break;
Can we split this part that changes map() out in a separate patch that
drops SHELL_SURFACE_TRANSIENT first like you did for
SHELL_SURFACE_MAXIMIZE/FULLSCREEN? Then shsurf->parent == NULL means
"not transient_for" and shsurf->parent != NULL means "transient for
that surface".
Kristian
> }
>
> if (shsurf->type != SHELL_SURFACE_NONE) {
> --
> 1.8.3.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list