1
0
Fork 0

wayland: Handle get_subsurface() with a role-less parent surface

The order of role creation is undetermined, so we can't account that
the parent surface will have a role (and an actor) at the time of
creating the wl_subsurface role for a child surface.

So we must do it both ways, add the subsurface as a child on
get_subsurface() if the parent already got a role, and lazily add
child subsurface actors to the current one if the parent surface got
it at a later point.

Related: #132
This commit is contained in:
Carlos Garnacho 2018-06-04 16:11:42 +02:00
parent 8ee14a7cb7
commit 69ca584168
2 changed files with 13 additions and 2 deletions

View file

@ -72,10 +72,18 @@ meta_wayland_actor_surface_assigned (MetaWaylandSurfaceRole *surface_role)
meta_wayland_actor_surface_get_instance_private (META_WAYLAND_ACTOR_SURFACE (surface_role));
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
GList *l;
meta_surface_actor_wayland_add_frame_callbacks (META_SURFACE_ACTOR_WAYLAND (priv->actor),
&surface->pending_frame_callback_list);
wl_list_init (&surface->pending_frame_callback_list);
for (l = surface->subsurfaces; l; l = l->next)
{
ClutterActor *subsurface_actor =
CLUTTER_ACTOR (meta_wayland_surface_get_actor (l->data));
clutter_actor_add_child (CLUTTER_ACTOR (priv->actor), subsurface_actor);
}
}
static void

View file

@ -471,8 +471,11 @@ wl_subcompositor_get_subsurface (struct wl_client *client,
&surface->sub.parent_destroy_listener);
parent->subsurfaces = g_list_append (parent->subsurfaces, surface);
if (meta_wayland_surface_get_actor (parent))
{
clutter_actor_add_child (CLUTTER_ACTOR (meta_wayland_surface_get_actor (parent)),
CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface)));
}
clutter_actor_set_reactive (CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface)), TRUE);
}