X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fshell.c;h=cbe1252d0d3e743aa8609befc648f5b5dcb53104;hb=refs%2Fheads%2Fneedlefish;hp=bf143020d676afeeca51e30c57bcc130433ec819;hpb=13ac8bab43fffd002196d3a6760eefaa8944def2;p=src%2Fagl-compositor.git diff --git a/src/shell.c b/src/shell.c index bf14302..cbe1252 100644 --- a/src/shell.c +++ b/src/shell.c @@ -87,6 +87,16 @@ ivi_set_desktop_surface(struct ivi_surface *surface) agl_shell_desktop_advertise_application_id(ivi, surface); } +static void +ivi_set_background_surface(struct ivi_surface *surface) +{ + struct ivi_compositor *ivi = surface->ivi; + assert(surface->role == IVI_SURFACE_ROLE_BACKGROUND); + + wl_list_insert(&surface->ivi->surfaces, &surface->link); + agl_shell_desktop_advertise_application_id(ivi, surface); +} + static void ivi_set_desktop_surface_popup(struct ivi_surface *surface) { @@ -467,7 +477,7 @@ ivi_set_pending_desktop_surface_remote(struct ivi_output *ioutput, if (!p_remote) return; - wl_list_insert(&ivi->remote_pending_apps, &remote->link); + wl_list_insert(&ivi->remote_pending_apps, &p_remote->link); } @@ -626,14 +636,9 @@ ivi_check_pending_surface_desktop(struct ivi_surface *surface, const char *app_id = weston_desktop_surface_get_app_id(surface->dsurface); - if (!app_id) { - *role = IVI_SURFACE_ROLE_NONE; - return; - } - role_pending_list = &ivi->popup_pending_apps; wl_list_for_each(p_popup, role_pending_list, link) { - if (!strcmp(app_id, p_popup->app_id)) { + if (app_id && !strcmp(app_id, p_popup->app_id)) { *role = IVI_SURFACE_ROLE_POPUP; return; } @@ -641,7 +646,7 @@ ivi_check_pending_surface_desktop(struct ivi_surface *surface, role_pending_list = &ivi->split_pending_apps; wl_list_for_each(p_split, role_pending_list, link) { - if (!strcmp(app_id, p_split->app_id)) { + if (app_id && !strcmp(app_id, p_split->app_id)) { *role = IVI_SURFACE_ROLE_SPLIT_V; return; } @@ -649,7 +654,7 @@ ivi_check_pending_surface_desktop(struct ivi_surface *surface, role_pending_list = &ivi->fullscreen_pending_apps; wl_list_for_each(p_fullscreen, role_pending_list, link) { - if (!strcmp(app_id, p_fullscreen->app_id)) { + if (app_id && !strcmp(app_id, p_fullscreen->app_id)) { *role = IVI_SURFACE_ROLE_FULLSCREEN; return; } @@ -657,7 +662,7 @@ ivi_check_pending_surface_desktop(struct ivi_surface *surface, role_pending_list = &ivi->remote_pending_apps; wl_list_for_each(p_remote, role_pending_list, link) { - if (!strcmp(app_id, p_remote->app_id)) { + if (app_id && !strcmp(app_id, p_remote->app_id)) { *role = IVI_SURFACE_ROLE_REMOTE; return; } @@ -744,6 +749,63 @@ 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) +{ + struct ivi_output *output; + + 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); + + wl_list_for_each(output, &ivi->outputs, link) { + if (output->fullscreen_view.fs->view) { + weston_surface_destroy(output->fullscreen_view.fs->view->surface); + output->fullscreen_view.fs->view = NULL; + } + } + weston_layer_fini(&ivi->fullscreen); +} + static void ivi_shell_advertise_xdg_surfaces(struct ivi_compositor *ivi, struct wl_resource *resource) { @@ -972,8 +1034,14 @@ shell_ready(struct wl_client *client, struct wl_resource *shell_res) ivi->shell_client.ready = true; wl_list_for_each(output, &ivi->outputs, link) { - if (output->background) + if (output->background && + output->background->role == IVI_SURFACE_ROLE_BACKGROUND) { + /* track the background surface role as a "regular" + * surface so we can activate it */ + ivi_set_background_surface(output->background); remove_black_surface(output); + } + ivi_layout_init(ivi, output); } @@ -1338,14 +1406,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");