diff options
author | Emre Ucan <eucan@de.adit-jv.com> | 2015-04-07 13:23:28 +0200 |
---|---|---|
committer | Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp> | 2015-05-13 16:06:27 +0900 |
commit | 5d751d39be5c4d8ae2301aebdf85c8fdf7ecb6ec (patch) | |
tree | 72c0339f6dd061644ce11f597a94a574aad9a249 /ivi-input-api | |
parent | 8f2dd331346d16e2bd36b5615d7424ddecd9792a (diff) | |
download | wayland-ivi-extension-5d751d39be5c4d8ae2301aebdf85c8fdf7ecb6ec.tar.gz |
ilmInput: implement ilm_getInputFocus
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Diffstat (limited to 'ivi-input-api')
-rw-r--r-- | ivi-input-api/ilmInput/src/ilm_input.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/ivi-input-api/ilmInput/src/ilm_input.c b/ivi-input-api/ilmInput/src/ilm_input.c index a0fb8df..511eab9 100644 --- a/ivi-input-api/ilmInput/src/ilm_input.c +++ b/ivi-input-api/ilmInput/src/ilm_input.c @@ -282,5 +282,41 @@ ILM_EXPORT ilmErrorTypes ilm_getInputFocus(t_ilm_surface **surfaceIDs, ilmInputDevice **bitmasks, t_ilm_uint *num_ids) { - return ILM_FAILED; + struct ilm_control_context *ctx; + int i = 0; + struct surface_context *ctx_surf; + + if ((surfaceIDs == NULL) || (bitmasks == NULL) + ||(num_ids == NULL)) { + fprintf(stderr, "Invalid Argument\n"); + return ILM_FAILED; + } + + ctx = sync_and_acquire_instance(); + *num_ids = wl_list_length(&ctx->wl.list_surface); + *surfaceIDs = calloc(*num_ids, sizeof **surfaceIDs); + + if (*surfaceIDs == NULL) { + fprintf(stderr, "Failed to allocate memory for surface ID list\n"); + release_instance(); + return ILM_FAILED; + } + + *bitmasks = calloc(*num_ids, sizeof **bitmasks); + if (*bitmasks == NULL) { + fprintf(stderr, "Failed to allocate memory for bitmask list\n"); + free(*surfaceIDs); + release_instance(); + return ILM_FAILED; + } + + wl_list_for_each(ctx_surf, &ctx->wl.list_surface, link) { + (*surfaceIDs)[i] = ctx_surf->id_surface; + (*bitmasks)[i] = ctx_surf->prop.focus; + i++; + } + + release_instance(); + return ILM_SUCCESS; + } |