summaryrefslogtreecommitdiff
path: root/ivi-input-api
diff options
context:
space:
mode:
authorEmre Ucan <eucan@de.adit-jv.com>2015-04-07 13:14:49 +0200
committerNobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>2015-05-13 16:06:26 +0900
commit4dd8795c964b14ca6d520108edab3ce8a2f8b1b8 (patch)
treefc0b7054307a3b6dfd7f6ac7f13c934626c38c4b /ivi-input-api
parent15fa542970930402ed7f2e85f4ee432dbe18a096 (diff)
downloadwayland-ivi-extension-4dd8795c964b14ca6d520108edab3ce8a2f8b1b8.tar.gz
ilmInput: implement ilm_setInputAcceptanceOn
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.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/ivi-input-api/ilmInput/src/ilm_input.c b/ivi-input-api/ilmInput/src/ilm_input.c
index 19ee6fa..e320138 100644
--- a/ivi-input-api/ilmInput/src/ilm_input.c
+++ b/ivi-input-api/ilmInput/src/ilm_input.c
@@ -38,7 +38,65 @@ ILM_EXPORT ilmErrorTypes
ilm_setInputAcceptanceOn(t_ilm_surface surfaceID, t_ilm_uint num_seats,
t_ilm_string *seats)
{
- return ILM_FAILED;
+ struct ilm_control_context *ctx;
+ int i;
+ struct surface_context *surface_ctx = NULL;
+ struct accepted_seat *accepted_seat;
+ int surface_found = 0;
+
+ if ((seats == NULL) && (num_seats != 0)) {
+ fprintf(stderr, "Invalid Argument\n");
+ return ILM_FAILED;
+ }
+
+ ctx = sync_and_acquire_instance();
+
+ wl_list_for_each(surface_ctx, &ctx->wl.list_surface, link) {
+ if (surface_ctx->id_surface == surfaceID) {
+ surface_found = 1;
+ break;
+ }
+ }
+
+ if (!surface_found) {
+ fprintf(stderr, "surface ID %d not found\n", surfaceID);
+ release_instance();
+ return ILM_FAILED;
+ }
+ /* Send events to add input acceptance for every seat in 'seats', but
+ * not on the surface's list */
+ for(i = 0; i < num_seats; i++) {
+ int seat_found = 0;
+
+ wl_list_for_each(accepted_seat, &surface_ctx->list_accepted_seats,
+ link) {
+ if (strcmp(accepted_seat->seat_name, seats[i]) == 0)
+ seat_found = 1;
+ }
+ if (!seat_found) {
+ ivi_input_set_input_acceptance(ctx->wl.input_controller,
+ surfaceID, seats[i],
+ ILM_TRUE);
+ }
+ }
+
+ /* Send events to remove input acceptance for every seat on the surface's
+ * list but not in 'seats' */
+ wl_list_for_each(accepted_seat, &surface_ctx->list_accepted_seats, link) {
+ int seat_found = 0;
+ for (i = 0; i < num_seats; i++) {
+ if (strcmp(accepted_seat->seat_name, seats[i]) == 0)
+ seat_found = 1;
+ }
+ if (!seat_found)
+ ivi_input_set_input_acceptance(ctx->wl.input_controller,
+ surfaceID,
+ accepted_seat->seat_name,
+ ILM_FALSE);
+ }
+
+ release_instance();
+ return ILM_SUCCESS;
}
ILM_EXPORT ilmErrorTypes