summaryrefslogtreecommitdiff
path: root/ivi-input-api/ilmInput
diff options
context:
space:
mode:
authorEmre Ucan <eucan@de.adit-jv.com>2015-04-07 13:22:00 +0200
committerNobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>2015-05-13 16:06:26 +0900
commit8f2dd331346d16e2bd36b5615d7424ddecd9792a (patch)
tree83442d9d3e3bcc7f65bd9a47cbc71d35cb4cd16f /ivi-input-api/ilmInput
parent2ec87cd04a552444607ae2c97399e34d29e9ddec (diff)
downloadwayland-ivi-extension-8f2dd331346d16e2bd36b5615d7424ddecd9792a.tar.gz
ilmInput: implement ilm_setInputFocus
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Diffstat (limited to 'ivi-input-api/ilmInput')
-rw-r--r--ivi-input-api/ilmInput/src/ilm_input.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/ivi-input-api/ilmInput/src/ilm_input.c b/ivi-input-api/ilmInput/src/ilm_input.c
index 005e91e..a0fb8df 100644
--- a/ivi-input-api/ilmInput/src/ilm_input.c
+++ b/ivi-input-api/ilmInput/src/ilm_input.c
@@ -238,7 +238,44 @@ ILM_EXPORT ilmErrorTypes
ilm_setInputFocus(t_ilm_surface *surfaceIDs, t_ilm_uint num_surfaces,
ilmInputDevice bitmask, t_ilm_bool is_set)
{
- return ILM_FAILED;
+ struct ilm_control_context *ctx;
+ int i;
+
+ if (surfaceIDs == NULL) {
+ fprintf(stderr, "Invalid Argument\n");
+ return ILM_FAILED;
+ }
+
+ if (bitmask & (ILM_INPUT_DEVICE_POINTER | ILM_INPUT_DEVICE_TOUCH)
+ && num_surfaces > 1 && is_set == ILM_TRUE) {
+ fprintf(stderr,
+ "Cannot set pointer or touch focus for multiple surfaces\n");
+ release_instance();
+ return ILM_FAILED;
+ }
+
+ ctx = sync_and_acquire_instance();
+ for (i = 0; i < num_surfaces; i++) {
+ struct surface_context *ctx_surf;
+ int found_surface = 0;
+ wl_list_for_each(ctx_surf, &ctx->wl.list_surface, link) {
+ if (ctx_surf->id_surface == surfaceIDs[i]) {
+ found_surface = 1;
+ break;
+ }
+ }
+
+ if (!found_surface) {
+ fprintf(stderr, "Surface %d was not found\n", surfaceIDs[i]);
+ continue;
+ }
+
+ ivi_input_set_input_focus(ctx->wl.input_controller,
+ ctx_surf->id_surface,
+ bitmask, is_set);
+ }
+ release_instance();
+ return ILM_SUCCESS;
}
ILM_EXPORT ilmErrorTypes