remove ivi_controller_surface on content_removed event 1.2.0_rc4
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Mon, 7 Apr 2014 14:11:43 +0000 (16:11 +0200)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Mon, 7 Apr 2014 14:11:43 +0000 (16:11 +0200)
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 <timo.lotterbach@bmw-carit.de>
ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c

index 780faea..d4cd6d4 100644 (file)
@@ -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