From f8457f6d62370f08a4764f44c670bd2368e80415 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Wed, 5 Feb 2020 18:37:05 +0200 Subject: [PATCH] shell: Allow the client shell to unbind/rebind to agl-shell interface Restarting the client shell requires the compositor to restart, this removes the ivi_surfaces and from the ivi_output and normal surfaces, pending surfaces and re-initilizes the lists for handling them. Bug-AGL: SPEC-3158 Signed-off-by: Marius Vlad Change-Id: Ic352ad5bc1e60b3df5b76a0239895aaf3aa81c56 --- src/shell.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/shell.c b/src/shell.c index 67f6d88..6a1596e 100644 --- a/src/shell.c +++ b/src/shell.c @@ -344,6 +344,53 @@ static const struct agl_shell_interface agl_shell_implementation = { static void unbind_agl_shell(struct wl_resource *resource) { + struct ivi_compositor *ivi; + struct ivi_output *output; + struct ivi_surface *surf, *surf_tmp; + + ivi = wl_resource_get_user_data(resource); + wl_list_for_each(output, &ivi->outputs, link) { + free(output->background); + output->background = NULL; + + free(output->top); + output->top = NULL; + + free(output->bottom); + output->bottom = NULL; + + free(output->left); + output->left = NULL; + + free(output->right); + output->right = NULL; + + /* reset the active surf if there's one present */ + if (output->active) { + 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; + } + } + + wl_list_for_each_safe(surf, surf_tmp, &ivi->surfaces, link) { + wl_list_remove(&surf->link); + wl_list_init(&surf->link); + } + + wl_list_for_each_safe(surf, surf_tmp, &ivi->pending_surfaces, link) { + wl_list_remove(&surf->link); + wl_list_init(&surf->link); + } + + wl_list_init(&ivi->surfaces); + wl_list_init(&ivi->pending_surfaces); + + ivi->shell_client.ready = false; + ivi->shell_client.resource = NULL; + ivi->shell_client.client = NULL; } static void -- 2.16.6