void
pepper_subsurface_destroy(pepper_subsurface_t *subsurface);
+void
+subsurface_destroy_children_views(pepper_subsurface_t *subsurface, pepper_view_t *parent_view);
+
+void
+subsurface_create_children_views(pepper_subsurface_t *subsurface, pepper_view_t *parent_view);
+
/* Input */
struct pepper_pointer
{
return PEPPER_FALSE;
}
+
+void
+subsurface_destroy_children_views(pepper_subsurface_t *subsurface, pepper_view_t *parent_view)
+{
+ pepper_list_t *list;
+
+ if (!subsurface)
+ return ;
+
+ pepper_list_for_each_list(list, &subsurface->children_list)
+ {
+ pepper_subsurface_t *child = list->item;
+
+ /* Except its own */
+ if(child && (child != subsurface))
+ {
+ pepper_view_t *view;
+
+ pepper_list_for_each(view, &subsurface->surface->view_list, surface_link)
+ {
+ if (view->parent == parent_view)
+ {
+ /* FIXME: need this ? */
+ pepper_view_set_surface(view, NULL);
+ pepper_view_destroy(view);
+ }
+ }
+ }
+ }
+}
+
+void
+subsurface_create_children_views(pepper_subsurface_t *subsurface, pepper_view_t *parent_view)
+{
+ pepper_list_t *list;
+
+ if (!subsurface)
+ return ;
+
+ pepper_list_for_each_list(list, &subsurface->children_list)
+ {
+ pepper_subsurface_t *child = list->item;
+
+ /* Except its own */
+ if(child && (child != subsurface))
+ {
+ pepper_view_t *view = pepper_compositor_add_view(subsurface->surface->compositor);
+ pepper_view_set_surface(view, child->surface);
+ pepper_view_set_parent(view, parent_view);
+ pepper_view_set_transform_inherit(view, PEPPER_TRUE);
+
+ /* FIXME */
+ pepper_view_map(view);
+ }
+ }
+
+ subsurface->need_restack = PEPPER_TRUE;
+}
return view;
}
+static void
+view_unlink_from_surface(pepper_view_t *view)
+{
+ pepper_list_remove(&view->surface_link);
+
+ subsurface_destroy_children_views(view->surface->sub, view);
+}
+
+static void
+view_link_to_surface(pepper_view_t *view)
+{
+ pepper_list_insert(&view->surface->view_list, &view->surface_link);
+
+ subsurface_create_children_views(view->surface->sub, view);
+}
+
PEPPER_API pepper_bool_t
pepper_view_set_surface(pepper_view_t *view, pepper_surface_t *surface)
{
return PEPPER_TRUE;
if (view->surface)
- pepper_list_remove(&view->surface_link);
+ view_unlink_from_surface(view);
view->surface = surface;
if (view->surface)
- pepper_list_insert(&surface->view_list, &view->surface_link);
+ view_link_to_surface(view);
pepper_view_mark_dirty(view, PEPPER_VIEW_GEOMETRY_DIRTY);
return PEPPER_TRUE;