X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fshell.c;h=d91570f75b39baf8e2087cf9f4d164c9b6a0bfdb;hb=refs%2Fchanges%2F42%2F27442%2F1;hp=bf143020d676afeeca51e30c57bcc130433ec819;hpb=13ac8bab43fffd002196d3a6760eefaa8944def2;p=src%2Fagl-compositor.git diff --git a/src/shell.c b/src/shell.c index bf14302..d91570f 100644 --- a/src/shell.c +++ b/src/shell.c @@ -49,6 +49,18 @@ static void create_black_surface_view(struct ivi_output *output); +static struct ivi_surface * +get_ivi_shell_surface(struct weston_surface *wsurface) +{ + if (weston_surface_is_desktop_surface(wsurface)) { + struct weston_desktop_surface *dsurface = + weston_surface_get_desktop_surface(wsurface); + return weston_desktop_surface_get_user_data(dsurface); + } + + return NULL; +} + void agl_shell_desktop_advertise_application_id(struct ivi_compositor *ivi, struct ivi_surface *surface) @@ -744,6 +756,53 @@ ivi_shell_init(struct ivi_compositor *ivi) return 0; } + +static void +ivi_surf_destroy(struct ivi_surface *surf) +{ + struct weston_surface *wsurface = surf->view->surface; + + if (weston_surface_is_mapped(wsurface)) { + weston_desktop_surface_unlink_view(surf->view); + weston_view_destroy(surf->view); + } + + wl_list_remove(&surf->link); + free(surf); +} + +static void +ivi_shell_destroy_views_on_layer(struct weston_layer *layer) +{ + struct weston_view *view, *view_next; + + wl_list_for_each_safe(view, view_next, &layer->view_list.link, layer_link.link) { + struct ivi_surface *ivi_surf = + get_ivi_shell_surface(view->surface); + if (ivi_surf) + ivi_surf_destroy(ivi_surf); + } +} + +void +ivi_shell_finalize(struct ivi_compositor *ivi) +{ + ivi_shell_destroy_views_on_layer(&ivi->hidden); + weston_layer_fini(&ivi->hidden); + + ivi_shell_destroy_views_on_layer(&ivi->background); + weston_layer_fini(&ivi->background); + + ivi_shell_destroy_views_on_layer(&ivi->normal); + weston_layer_fini(&ivi->normal); + + ivi_shell_destroy_views_on_layer(&ivi->panel); + weston_layer_fini(&ivi->panel); + + ivi_shell_destroy_views_on_layer(&ivi->popup); + weston_layer_fini(&ivi->popup); +} + static void ivi_shell_advertise_xdg_surfaces(struct ivi_compositor *ivi, struct wl_resource *resource) { @@ -1338,14 +1397,6 @@ bind_agl_shell(struct wl_client *client, return; } -#if 0 - if (ivi->shell_client.client != client) { - wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, - "client not authorized to use agl_shell"); - return; - } -#endif - if (ivi->shell_client.resource) { wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, "agl_shell has already been bound");