X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fshell.c;h=68227c317f0041904087e771acf54eddf3c2b33f;hb=refs%2Fheads%2Foctopus;hp=4f564afeebb1deb3979937d5fdb19b3cba47e64c;hpb=c01b90ece22cc587e94b99f4e3bce50d7a3571eb;p=src%2Fagl-compositor.git diff --git a/src/shell.c b/src/shell.c index 4f564af..68227c3 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1088,7 +1088,8 @@ create_black_curtain_view(struct ivi_output *output) bool output_has_black_curtain(struct ivi_output *output) { - return (output->fullscreen_view.fs->view && + return (output->fullscreen_view.fs && + output->fullscreen_view.fs->view && output->fullscreen_view.fs->view->is_mapped && output->fullscreen_view.fs->view->surface->is_mapped); } @@ -1174,7 +1175,9 @@ shell_ready(struct wl_client *client, struct wl_resource *shell_res) struct ivi_output *output; struct ivi_surface *surface, *tmp; - if (ivi->shell_client.status == BOUND_FAILED) { + if (wl_resource_get_version(shell_res) >= + AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) { wl_resource_post_error(shell_res, WL_DISPLAY_ERROR_INVALID_OBJECT, "agl_shell has already been bound. " @@ -1228,8 +1231,10 @@ shell_set_background(struct wl_client *client, struct weston_desktop_surface *dsurface; struct ivi_surface *surface; - if (ivi->shell_client.status == BOUND_FAILED || - ivi->shell_client.resource_ext == shell_res) { + if ((wl_resource_get_version(shell_res) >= + AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) || + ivi->shell_client.resource_ext == shell_res) { wl_resource_post_error(shell_res, WL_DISPLAY_ERROR_INVALID_OBJECT, "agl_shell has already been bound. " @@ -1291,7 +1296,9 @@ shell_set_panel(struct wl_client *client, struct ivi_surface **member; int32_t width = 0, height = 0; - if (ivi->shell_client.status == BOUND_FAILED || + if ((wl_resource_get_version(shell_res) >= + AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) || ivi->shell_client.resource_ext == shell_res) { wl_resource_post_error(shell_res, WL_DISPLAY_ERROR_INVALID_OBJECT, @@ -1403,12 +1410,24 @@ shell_activate_app(struct wl_client *client, const char *app_id, struct wl_resource *output_res) { - struct weston_head *head = weston_head_from_resource(output_res); - struct weston_output *woutput = weston_head_get_output(head); - struct ivi_compositor *ivi = wl_resource_get_user_data(shell_res); - struct ivi_output *output = to_ivi_output(woutput); + struct weston_head *head; + struct weston_output *woutput; + struct ivi_compositor *ivi; + struct ivi_output *output; - if (ivi->shell_client.status == BOUND_FAILED) { + head = weston_head_from_resource(output_res); + if (!head) { + weston_log("Invalid output to activate '%s' on\n", app_id); + return; + } + + woutput = weston_head_get_output(head); + ivi = wl_resource_get_user_data(shell_res); + output = to_ivi_output(woutput); + + if (wl_resource_get_version(shell_res) >= + AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) { wl_resource_post_error(shell_res, WL_DISPLAY_ERROR_INVALID_OBJECT, "agl_shell has already been bound. " @@ -1453,7 +1472,8 @@ shell_destroy(struct wl_client *client, struct wl_resource *res) struct ivi_compositor *ivi = wl_resource_get_user_data(res); /* reset status in case bind_fail was sent */ - if (ivi->shell_client.status == BOUND_FAILED) + if (wl_resource_get_version(res) >= AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) ivi->shell_client.status = BOUND_OK; } @@ -1594,19 +1614,26 @@ unbind_agl_shell(struct wl_resource *resource) ivi = wl_resource_get_user_data(resource); /* reset status to allow other clients issue legit requests */ - if (ivi->shell_client.status == BOUND_FAILED) { + if (wl_resource_get_version(resource) >= + AGL_SHELL_BOUND_OK_SINCE_VERSION && + ivi->shell_client.status == BOUND_FAILED) { ivi->shell_client.status = BOUND_OK; return; } wl_list_for_each(output, &ivi->outputs, link) { + /* reset the active surf if there's one present */ if (output->active) { + struct weston_geometry area = {}; + output->active->view->is_mapped = false; output->active->view->surface->is_mapped = false; weston_layer_entry_remove(&output->active->view->layer_link); output->active = NULL; + + output->area_activation = area; } insert_black_curtain(output);