[PATCH weston 5/6] compositor: forbid sub-surface nesting loops
From: Pekka Paalanen pekka.paala...@collabora.co.uk The only way to create a sub-surface loop by recursive nesting is to make the main surface (which does not have a role) a sub-surface of any of its sub-surfaces. All other cases should already be cought. This change checks for that exact case, and sends a protocol error. Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk --- src/compositor.c | 8 1 file changed, 8 insertions(+) diff --git a/src/compositor.c b/src/compositor.c index ed250ba..f67028e 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -2295,6 +2295,14 @@ subcompositor_get_subsurface(struct wl_client *client, return; } + if (weston_surface_get_main_surface(parent) == surface) { + wl_resource_post_error(resource, + WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE, + %s%d: wl_surface@%d is an ancestor of parent, + where, id, surface_resource-object.id); + return; + } + /* make sure the parent is in its own list */ if (wl_list_empty(parent-subsurface_list)) { if (!weston_subsurface_create_for_parent(parent)) { -- 1.8.1.5 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 5/6] compositor: forbid sub-surface nesting loops
Is it impossible to change the parent of an existing subsurface? If it is possible then ABC and attempting to change B's parent to C will produce a loop and not get detected by this test since get_main_surface(C) is A which is not equal to B. If this is not possible it seems pretty limiting as clients have to destroy and recreate surfaces to make some rearrangements. ppaala...@gmail.com wrote: From: Pekka Paalanen pekka.paala...@collabora.co.uk The only way to create a sub-surface loop by recursive nesting is to make the main surface (which does not have a role) a sub-surface of any of its sub-surfaces. All other cases should already be cought. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 5/6] compositor: forbid sub-surface nesting loops
On 17 May 2013 21:09, Bill Spitzak spit...@gmail.com wrote: Is it impossible to change the parent of an existing subsurface? Yes. If this is not possible it seems pretty limiting as clients have to destroy and recreate surfaces to make some rearrangements. No, they only have to destroy and recreate the subsurface objects. I recommend you go read the subsurface protocol. ppaala...@gmail.com wrote: From: Pekka Paalanen pekka.paala...@collabora.co.uk The only way to create a sub-surface loop by recursive nesting is to make the main surface (which does not have a role) a sub-surface of any of its sub-surfaces. All other cases should already be cought. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel