shell: Allow the client shell to unbind/rebind to agl-shell interface 44/23744/1
authorMarius Vlad <marius.vlad@collabora.com>
Wed, 5 Feb 2020 16:37:05 +0000 (18:37 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Thu, 6 Feb 2020 11:40:06 +0000 (13:40 +0200)
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 <marius.vlad@collabora.com>
Change-Id: Ic352ad5bc1e60b3df5b76a0239895aaf3aa81c56

src/shell.c

index 67f6d88..6a1596e 100644 (file)
@@ -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