From 0016a4948cdb0ce2f043454bcee17353803e9282 Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Mon, 7 Apr 2014 16:11:43 +0200 Subject: [PATCH] remove ivi_controller_surface on content_removed event in ILM API, surfaceDestroy(x) will remove all references to this surface from scene. To achieve same behavior, ivi controllers must release their corresponding ivi_controller_surfaces on content_removed event. Signed-off-by: Timo Lotterbach --- .../ilmControl/src/ilm_control_wayland_platform.c | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c index 780faea..d4cd6d4 100644 --- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c +++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c @@ -1104,9 +1104,26 @@ controller_surface_listener_content(void *data, struct ivi_controller_surface *controller, int32_t content_state) { - (void)data; - (void)controller; - (void)content_state; + // if client surface (=content) was removed with ilm_surfaceDestroy() + // the expected behavior within ILM API mandates a full removal + // of the surface from the scene. We must remove the controller + // from scene, too. + if (IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_REMOVED == content_state) + { + struct wayland_context *ctx = data; + struct surface_context *ctx_surf = NULL; + + ctx_surf = get_surface_context_by_controller(ctx, controller); + if (ctx_surf == NULL) { + fprintf(stderr, "Invalid controller_surface in %s\n", __FUNCTION__); + return; + } + + ivi_controller_surface_destroy(controller, IVI_CONTROLLER_OBJECT_TYPE_SURFACE); + + wl_list_remove(&ctx_surf->link); + free(ctx_surf); + } } static void -- 2.7.4