From bf765341d315f172934d91371b6d83483b894f17 Mon Sep 17 00:00:00 2001 From: Nobuhiko Tanibata Date: Sun, 10 Aug 2014 21:57:22 +0900 Subject: ilmControl: allow to set callback of surfaceAddNotification even if application doen't map ID to wl_surface. When application map ID to wl_surface by ivi_application.createSurface, content_state is notified with content_available. Signed-off-by: Nobuhiko Tanibata --- .../ilmControl/src/ilm_control_wayland_platform.c | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 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 e3f0e56..11789e0 100644 --- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c +++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c @@ -168,6 +168,7 @@ static inline void unlock_context(struct ilm_control_context *ctx) static int init_control(void); static struct ilm_control_context* sync_and_acquire_instance(void); +static struct surface_context* get_surface_context(struct wayland_context *, uint32_t); static void release_instance(void); @@ -804,12 +805,14 @@ controller_listener_surface(void *data, { struct wayland_context *ctx = data; struct surface_context *ctx_surf = NULL; - int32_t is_inside = 0; - - is_inside = wayland_controller_is_inside_surface_list( - &ctx->list_surface, id_surface); - if (is_inside != 0) { + ctx_surf = get_surface_context(ctx, id_surface); + if (ctx_surf != NULL) { + if (ctx_surf-> notification != NULL) { + ctx_surf->notification(ctx_surf->id_surface, + &ctx_surf->prop, + ILM_NOTIFICATION_ALL); + } fprintf(stderr, "invalid id_surface in controller_listener_surface\n"); return; } @@ -2399,9 +2402,16 @@ ilm_surfaceAddNotification(t_ilm_surface surface, ctx_surf = (struct surface_context*)get_surface_context( &ctx->wl, (uint32_t)surface); + if (ctx_surf == NULL) { + controller_listener_surface(ctx, ctx->wl.controller, (uint32_t)surface); + ctx_surf = (struct surface_context*)get_surface_context( + &ctx->wl, (uint32_t)surface); + } + if (ctx_surf == NULL) { returnValue = ILM_ERROR_INVALID_ARGUMENTS; - } else { + } + else { ctx_surf->notification = callback; returnValue = ILM_SUCCESS; @@ -2505,11 +2515,6 @@ ilm_layerRemoveSurface(t_ilm_layer layerId, returnValue = ILM_SUCCESS; } - if ((ctx_surf != NULL) && (ctx_surf->notification != NULL)) { - ctx_surf->notification = NULL; - returnValue = ILM_SUCCESS; - } - release_instance(); return returnValue; } -- cgit v1.2.1