diff options
author | Emre Ucan <eucan@de.adit-jv.com> | 2015-05-18 10:31:35 +0200 |
---|---|---|
committer | Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp> | 2015-06-15 16:23:32 +0900 |
commit | ae871cd6b1800e9d9f0aded0759696b0b3614bed (patch) | |
tree | 3ac9c07d1d723dc1b2dad57e451e705fd50eeced /ivi-input-controller | |
parent | b14559f2c59d6730e197b54383e9868699774db3 (diff) | |
download | wayland-ivi-extension-ae871cd6b1800e9d9f0aded0759696b0b3614bed.tar.gz |
ivi-input-controller: call set_weston_focus by input_set_input_focus
set_weston_focus is called, if the surface has acceptance to a seat which
has capabilities to the input device
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Diffstat (limited to 'ivi-input-controller')
-rw-r--r-- | ivi-input-controller/src/ivi-input-controller.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/ivi-input-controller/src/ivi-input-controller.c b/ivi-input-controller/src/ivi-input-controller.c index eaeb689..926dde3 100644 --- a/ivi-input-controller/src/ivi-input-controller.c +++ b/ivi-input-controller/src/ivi-input-controller.c @@ -849,30 +849,44 @@ input_set_input_focus(struct wl_client *client, { struct input_controller *controller = wl_resource_get_user_data(resource); struct input_context *ctx = controller->input_context; - int found_surface = 0; - struct surface_ctx *surf; + struct surface_ctx *surf, *current_surf = NULL; + struct weston_seat *seat; const struct ivi_controller_interface *interface = ctx->ivi_controller_interface; - /* If focus is enabled for one of these devices, every other surface - * must have focus unset */ - const ilmInputDevice single_surface_devices = - ILM_INPUT_DEVICE_POINTER | ILM_INPUT_DEVICE_TOUCH; - ilmInputDevice single_surface_mask = single_surface_devices & device; + uint32_t caps; + struct ivi_layout_surface *current_layout_surface; + + current_layout_surface = interface->get_surface_from_id(surface); + + if (!current_layout_surface) { + weston_log("%s: surface %d was not found\n", __FUNCTION__, surface); + return; + } wl_list_for_each(surf, &ctx->surface_list, link) { - uint32_t current_surface = - interface->get_id_of_surface(surf->layout_surface); - if (current_surface == surface) { + if (current_layout_surface == surf->layout_surface) { + current_surf = surf; if (enabled == ILM_TRUE) { surf->focus |= device; } else { surf->focus &= ~device; } - send_input_focus(ctx, current_surface, device, enabled); - found_surface = 1; - } else if (single_surface_mask && enabled == ILM_TRUE) { - surf->focus &= ~(single_surface_mask); - send_input_focus(ctx, current_surface, single_surface_mask, ILM_FALSE); + + send_input_focus(ctx, surface, device, enabled); + + wl_list_for_each(seat, &ctx->compositor->seat_list, link) { + if (get_accepted_seat(surf, seat->seat_name) < 0) + continue; + + caps = get_seat_capabilities(seat); + + if (!(caps | device)) + continue; + + set_weston_focus(ctx, surf, device, seat, enabled); + } + + break; } } |